all worksheets except

  • Thread starter Thread starter david
  • Start date Start date
D

david

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
 
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
 
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.
 
Back
Top