View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
J@Y J@Y is offline
external usenet poster
 
Posts: 127
Default Question about a Variable being Nothing

This is my Code:
Public Var1, MyRange as Range


Sub A

For c = 1to 10 do
Call Sub B
Next c

end Sub A

Sub B

Set Var1 = MyRange.Find("Blah", lookat:=xlPart, _
Searchorder:=xlByRows)

if Not (Var1 is Nothing) then
Debug.print "Var1 exist"
end if

end Sub B

Sub B gets looped 10 times. I run into this problem where if Var1 is found
in one iteration, in the next iteration, even though it doesn't refer to any
Range, it is not recognized as Nothing anymore. Why is that?