Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If statement syntax to see if Worksheet_Activate code exists mikeburg[_55_] Excel Programming 2 December 5th 05 01:35 AM
Code to see if Comment Exists wardides[_13_] Excel Programming 6 November 28th 05 08:56 PM
VBA code to check if a custom chart exists shoba[_3_] Excel Programming 0 August 4th 05 02:12 PM
Worksheets Exists Code... KimberlyC Excel Programming 3 July 7th 05 09:19 PM
Help with code that checks if a sheet exists wachen Excel Programming 2 February 10th 04 02:39 AM


All times are GMT +1. The time now is 02:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"