View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
dok112[_90_] dok112[_90_] is offline
external usenet poster
 
Posts: 1
Default If Worksheet exists...Then run code


It will work. You would just need to reword it differently.

For each WS in worksheets
if WS.name = "sheetname" 'sheet to be found
else:
'code to be run
end if
next WS

With it this way, it's going to look for the sheetname. If it finds
it, it will skip that sheet. If it doesnt find it, then it will run
the code specified.

For example, if your sheetname is "Sheet5", if sheet5 is not there,
then it's going to run the code you specified. If it does exist, then
it will just continue to loop until it hits the end of the sheets.


--
dok112
------------------------------------------------------------------------
dok112's Profile: http://www.excelforum.com/member.php...o&userid=10581
View this thread: http://www.excelforum.com/showthread...hreadid=513809