G
Gary
Is it possible to use my own functions in an array formula? Is there a
special way I need to code such a function? I've tried writing it so
that it accepts a variant array as a parameter, but it doesn't seem to
work when I use it in an array formula.
For example:
Function MonthStart(ADate)
Dim i As Integer
If IsArray(ADate) Then
For i = LBound(ADate) To UBound(ADate)
ADate(i) = DateSerial(Year(ADate(i)), Month(ADate(i)), 1)
Next
MonthStart = ADate
Else
MonthStart = DateSerial(Year(ADate), Month(ADate), 1)
End If
End Function
special way I need to code such a function? I've tried writing it so
that it accepts a variant array as a parameter, but it doesn't seem to
work when I use it in an array formula.
For example:
Function MonthStart(ADate)
Dim i As Integer
If IsArray(ADate) Then
For i = LBound(ADate) To UBound(ADate)
ADate(i) = DateSerial(Year(ADate(i)), Month(ADate(i)), 1)
Next
MonthStart = ADate
Else
MonthStart = DateSerial(Year(ADate), Month(ADate), 1)
End If
End Function