find - vba-excel meaning of <> (angled brackets or greater-than and less-than symbols) -


i working find functions in vba excel, when ran problems pulled example code provided in excel. took code illustrates basic find function , pasted macro. on running macro, "runtime error '91'" , debugger highlights line of code containing angled brackets <>. these part of code cannot understand.

can tell me these brackets represent?

sub examplefindreplace()  worksheets(1).range("a1:a500") set c = .find(2, lookin:=xlvalues) if not c nothing     firstaddress = c.address             c.value = 5         set c = .findnext(c)     loop while not c nothing , c.address <> firstaddress end if end  end sub 

the <> operator means c.address is not equal to firstaddress.

in c-style language equivalent c.address != firstaddress.


side note, think getting error 91 (object variable or block variable not set.) because line of code loop while not c nothing , c.address <> firstaddress try execute second condition (c.address <> firstaddress) if first (while not c nothing) evaluates false. call on c.address raise exception.

try writing code not allow happen:

sub examplefindreplace()  worksheets(1).range("a1:a500") set c = .find(2, lookin:=xlvalues) if not c nothing     firstaddress = c.address             c.value = 5         set c = .findnext(c)         if c nothing exit     loop while c.address <> firstaddress end if end  end sub 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -