LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 147
Default Loop to skip some sheets in workbook

Harald Staff wrote:
"witek" skrev i melding
...
Harald Staff wrote:
"witek" skrev i melding
...
If ws.Name = "X" Or ws.Name = "Y" Or ws.Name = "Z" Then

AND not OR

If ws.Name < "X" AND ws.Name < "Y" AND ws.Name < "Z"


No. A ws can not have three names at the same time so that test will
always
fail.


try what is value of ws.Name < "X" AND ws.Name < "Y" AND ws.Name < "Z"
if ws.Name = "T" .


Sorry, you're right. It stated "AND not OR", but not "< not =" , so I
misread it. But it leaves the question why this? Does it perform better than
the original, or than a Select Case, or three If's ?



no difference between ifs.
simply if with empty then clause does not look good.
select case can be a little bit faster because once case is found it
jumps out of select case statement.






 
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
Loop several sheets - not all worksheets of workbook al Excel Programming 8 January 25th 09 11:25 PM
Master's please help me with my code; Doing a loop to copy valuesfrom a series Sheets of another workbook.. jhong Excel Programming 2 January 25th 08 10:30 AM
apply Macro to all sheets in workbook - loop [email protected] Excel Programming 3 July 19th 07 08:13 PM
Skip LOC in D While Loop Khurram Excel Programming 2 January 30th 07 05:15 PM
Loop through all sheets in workbook jennie Excel Programming 7 October 26th 05 11:54 AM


All times are GMT +1. The time now is 02:05 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"