Quote:
Originally Posted by charlesdh
Would still like see what I did wrong with the code that I have in the file
|
Well, you said you were looking for just the month, but strdate is only ever defined as a date in the format "mmm-yyyy". Naturally, that looks for the month and year, and will only find them if separated by a '-'. Furthermore, your Find expression looks at the formulae, not the displayed strings and requires a whole-of-cell match instead of a partial match. Try using something along the lines of:
Code:
Sub FindDate()
Dim strdate As String, rCell As Range, lReply As Long
strdate = Format(Sheets("Sheet2").Cells(2, 4).Text, "mmm")
Set rCell = Sheets("Sheet1").Cells.Find(What:=strdate, LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If Not rCell Is Nothing Then MsgBox rCell.Address
End Sub