I'm extremely new to VBA. I'm trying to get Excel to return the cell address, after searching for a date in a range of dates.
I have a range of dates in Column C all set as true date format.
1/12/2018 1/1/2019 1/2/2019 ...
And in D10 a single date. I want some VBA code to search Column C using the date in D10 as its criteria, and return the cell address of the result.
Thanks in advance for any help A
Edit.
Earlier in the vba I have defined D10 as a date variable called startingmonth.
This is the code I have. I was just using 43435 as text as a test, I want to use startingmonth here (which is D10) but when I replace 43435 with the variable, I receive error 6 overflow.
Dim startingmonth As Date
startingmonth = Excel.Application.WorksheetFunction.EoMonth(ActiveCell.Offset(-2, 0).Value2, -1) + 1
Dim rgFound As Range
Set rgFound = Range("C:C").Find("43435")
MsgBox rgFound.Address
Current workaround (from active cell D12)
ActiveCell.Offset(1, -1).Select
If ActiveCell.Value = startingmonth Then
MsgBox ActiveCell.Address
Else
GoTo Searchloop
End If
Searchloop:
ActiveCell.Offset(1, 0).Select
If ActiveCell.Value = startingmonth Then
MsgBox ActiveCell.Address
Else
GoTo Searchloop
End If