View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mishell Mishell is offline
external usenet poster
 
Posts: 22
Default Help with .Find Function in code

If the searched value was not found, you will get that error message:

Try like this to check that Not result Is Nothing :
Set result = dataCorrWS.Range("C2:C" & dataCorrWSlastRow).Find(c.Value, _
LookIn:=xlValues)

If Not result Is Nothing Then
result.Activate
End If

Mishell

"Ayo" wrote in message
...
I am trying to use the Find in my code but I am getting a "Object variable
or
With block variable not set" error message on the code line below.
dataCorrWS.Range("C2:C" & dataCorrWSlastRow).Find(c.Value,
LookIn:=xlValues).Activate

but another variation of the code:
Worksheets("InSite Milestones").Range("C2:C3000").Find("NY09337C",
LookIn:=xlValues).Activate

works fine. Any ideas.