ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   all worksheets except (https://www.excelbanter.com/excel-programming/273719-all-worksheets-except.html)

David

all worksheets except
 
I am trying to use a macro that will grab information off
of all the sheets in a book, but not off of 3 sheets that
have different info. How do I get it to go sheet by and
sheet and then do what I need them to do except skip the 3
sheets that I name. The problem is, is that the other
sheets names can change so I can't name any of the sheets
except the 3 that need to be skipped.
Thanks for you help,
David

Don Guillett[_4_]

all worksheets except
 
for each sh in sheets
if sh.name<"name1" or sh.name<"name2" or sh.name<"name3" then
sh.do your stuff here
end if
next sh

--
Don Guillett
SalesAid Software
Granite Shoals, TX

"david" wrote in message
...
I am trying to use a macro that will grab information off
of all the sheets in a book, but not off of 3 sheets that
have different info. How do I get it to go sheet by and
sheet and then do what I need them to do except skip the 3
sheets that I name. The problem is, is that the other
sheets names can change so I can't name any of the sheets
except the 3 that need to be skipped.
Thanks for you help,
David




Tom Ogilvy

all worksheets except
 

As written, this will do your stuff on every sheet since you will get a true
on every sheet name. Each sheet will statisfy at least two of the
conditions.

for each sh in sheets
if Lcase(sh.name)<"name1" and lcase(sh.name)<"name2" and _
lcase(sh.name)<"name3" then
sh.do your stuff here
end if
next sh


is probably what was intended.

--
Regards,
Tom Ogilvy


"Don Guillett" wrote in message
...
for each sh in sheets
if sh.name<"name1" or sh.name<"name2" or sh.name<"name3" then
sh.do your stuff here
end if
next sh

--
Don Guillett
SalesAid Software
Granite Shoals, TX

"david" wrote in message
...
I am trying to use a macro that will grab information off
of all the sheets in a book, but not off of 3 sheets that
have different info. How do I get it to go sheet by and
sheet and then do what I need them to do except skip the 3
sheets that I name. The problem is, is that the other
sheets names can change so I can't name any of the sheets
except the 3 that need to be skipped.
Thanks for you help,
David







All times are GMT +1. The time now is 07:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com