Gruppe
UDF
Problem
Über eine benutzerdefinierte Funktion soll ermittelt werden, wie oft ein Name ab einem bestimmten Datum in einem vorgegebenen Gebiet vorkommt.
StandardModule: Modul1
Function CountNames(Bereich As Range, Start As Date, Gebiet As String)
Dim rng As Range
Dim col As New Collection
Dim iCounter As Integer
On Error Resume Next
For Each rng In Bereich.Columns(1).Cells
If rng.Value > Start And rng.Offset(0, 2) = Gebiet Then
col.Add rng.Offset(0, 1).Value, rng.Offset(0, 1).Value
End If
Next rng
On Error GoTo 0
CountNames = col.Count
End Function