It's the first time I came across an "array formula" in VBA. This is not wrong, but not very evident to understand/troubleshoot. On my machine [where the range had all empty cells, it gives an error [myRange <> 0] = Error 2092, then within the Match function, then gets another error...
The array formulas are great in a formula worksheet only, but I feel you should avoid them in VBA. You have the ability to use loops in VBA, so, don't hesitate to use them! Having your train of though as explicit as possible is key when writing software (so you will understand it later!).
My suggestion would be this :
Option Explicit
Function FindDateColumnInRange(ByVal RangeToLookIn As Range) As Long
If RangeToLookIn.Rows.Count <> 1 Then
'The range you're looking in has more than one row
'what should you do in this case? Look only in the first row?
Else
Dim i As Long
'The range has only one row
For i = 0 To RangeToLookIn.Columns.Count - 1
If RangeToLookIn.Item(1, i).Value <> 0 Then
'should you verifiy that the value is a date value?
FindDateColumnInRange = RangeToLookIn.Item(1, i).Column
Exit Function
End If
Next
End If
'the range didn't have a value different from 0
FindDateColumnInRange = 0
End Function
In action, you would get :
Sub Test()
Dim MyRange As Range
Set MyRange = Worksheets("Portf_Mod").Range("AB368:CY368")
Dim date_col As Integer
date_col = FindDateColumnInRange(MyRange)
If date_col = 0 Then
'There was no date in your range
End If
End Sub
Yeah, it's a lot more long than SJR suggestions, but, it covers every exceptions and you can control how to look if you were to pass a multidimensionnal array (iterate through rows first then columns, or the other way around).