Gruppe
UDF
Problem
Es soll die Maximaltemperatur an einem bestimmten Datum errechnet werden.
StandardModule: basMain
Function Temperatur(dat As Date, rng As Range)
Dim rngAct As Range
Dim iStart As Integer, iEnd As Integer
For Each rngAct In rng.Cells
If rngAct = dat Then
iStart = rngAct.Row
iEnd = iStart
Exit For
End If
Next rngAct
Do
iEnd = iEnd + 1
Loop While rng.Cells(iEnd - 1, 1) = rng.Cells(iEnd, 1)
Temperatur = WorksheetFunction.Max( _
rng.Range(rng.Cells(iStart, 3), rng.Cells(iEnd, 3)))
End Function