View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Help needed with a macro


All data in the first row must be valid date entries.
If you have a mixed bag, then the cell value must be
confirmed as a date before the comparison is made...
'----
For Each rCell In rng
If IsDate(rCell.Value) Then '<<< new line
If Month(rCell.Value) = Month(FindString) Then
If Year(rCell.Value) = Year(FindString) Then
Application.Goto rCell, True
MsgBox rCell.Address
Exit Sub
End If
End If
End If '<<< new line
Next
'---
If the data in the first row cannot be read as dates, then
another approach is necessary (or you have to change the data).
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(please don't bottom post)


"Victor Delta"
wrote in message
Jim
Many thanks for your help.
However, I've pasted your macro into my sheet (changing 'other sheet' as
appropriate) but, when run it, I get a run-time error '13' - Type mismatch,
with the debugger highlighting this line:
If Month(rCell.Value) = Month(FindString) Then
Any ideas?
V