View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sharad Sharad is offline
external usenet poster
 
Posts: 123
Default Run-time error '91': "Object variable or With block variable not set

If .Find result is nothing then it will give that error, because of the
last .Activate part. If no match is found it is not referring to any
cell, so .Active for nothing will give that error.

Change the code as under & try:

Dim myRange As Range
Set myRange = .Find(What:="*/*/2004", After:=ActiveCell,
LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
If Not myRange Is Nothing Then myRange.Activate

Sharad



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!