Hi,
I am having difficulty trying to find a date using VBA.
I have a date range like so.
Cell C5 =01/01/2012
Cell D5 =C5+1
Cell E5 = D5+1
Cell F5 = E5+1
Formatted as dd (day date only)
Which gives me the dates ok
When try to use find function in vba it just doesn't find any dates
This is what I have
Dim iRes As Integer, dFind As Date, strMonth As String, iM As Long
Dim rngDate As Range
iRes = MsgBox(Prompt:="Print range", Buttons:=vbYesNo)
If iRes = vbNo Then
Exit Sub
ElseIf iRes = vbYes Then
strMonth = Me.cboMonth.Text
iM = Month(DateValue("01-" & strMonth & "-1900"))
dFind = DateSerial(Me.txtYear.Value, iM, 1)
Set rngDate = ActiveSheet.Range("C4:ND4").Find(what:=dFind, LookIn:=xlFormulas)
End If
rngDate always end up with nothing
How do I go about the correct way?
Thanks
Bookmarks