excel - Passing Range Names -


i have defined several ranges , example:

sheets(“customers”).activate set myr1 = range(cells(1,  1), cells(1,  25)) set myr2 = range(cells(5,  1), cells(5,  25)) set myr2 = range(cells(16,  1), cells(16,  25)) 

in procedure have written following code search range , process result. problem how call findany routine , pass different ranges required.

sub findany()     set foundrange =  myr1.find(what:=i)     if foundrange nothing             else         else     end if 

i think need this:

sub findany(rngtosearchin range)    '<< argument in line      set foundrange = rngtosearchin.find(what:=i)    '<<passed range used here     if foundrange nothing             else         else     end if 

when calling findany soubroutine use this:

call findany(myr1) 

or simply:

findany myr1 

Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -