Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default For Each Sheet But not all

Is there a way to do the For Each sheet and exclude sheets to have it
done to at the same time?

Thanks,
Jay
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default For Each Sheet But not all

dim wks as worksheet
for each wks in activeworkbook.worksheets
select case lcase(wks.name)
case is = "not this one", "or this one", "and not this"
'do nothing
case else
'do the real work
msgbox wks.name
end select
next wks

Make sure you type the names of the worksheets in lower case.

jlclyde wrote:

Is there a way to do the For Each sheet and exclude sheets to have it
done to at the same time?

Thanks,
Jay


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 410
Default For Each Sheet But not all

On Nov 6, 1:34*pm, Dave Peterson wrote:
dim wks as worksheet
for each wks in activeworkbook.worksheets
* *select case lcase(wks.name)
* * * *case is = "not this one", "or this one", "and not this"
* * * * * 'do nothing
* * * *case else
* * * * * 'do the real work
* * * * * msgbox wks.name
* *end select
next wks

Make sure you type the names of the worksheets in lower case.

jlclyde wrote:

Is there a way to do the For Each sheet and exclude sheets to have it
done to at the same time?


Thanks,
Jay


--

Dave Peterson


Dave,
You have been saving my butt left and right. Thanks again.
Jay
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,805
Default For Each Sheet But not all

for each ws in worksheets
if ws.name<"name you want to exclude" then
'do what you want to do
end if
next

"jlclyde" wrote:

Is there a way to do the For Each sheet and exclude sheets to have it
done to at the same time?

Thanks,
Jay

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default For Each Sheet But not all

Sub test()

exclude = Array("A", "B", "C")

For Each sht In Sheets
Found = False
For Each itm In exclude
If UCase(sht.Name) = UCase(tim) Then
Found = True
Exit For
End If
If Found = False Then

'enter you code here

End If
Next itm

Next sht


End Sub


"jlclyde" wrote:

Is there a way to do the For Each sheet and exclude sheets to have it
done to at the same time?

Thanks,
Jay



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
Duplicate sheet, autonumber sheet, record data on another sheet des-sa[_2_] Excel Worksheet Functions 0 May 8th 08 06:56 PM
lookup single value in one sheet, return multiple results from theother sheet Chuck[_3_] Excel Worksheet Functions 1 April 4th 08 06:17 AM
"='sheet 1'!D4" auto fill sheet to sheet ='sheet 2'!D4 mistewalker Excel Worksheet Functions 5 January 6th 08 11:36 PM
How do I select price from sheet.b where sheet.a part no = sheet.b Sonny Excel Worksheet Functions 4 April 4th 06 05:08 PM
relative sheet references ala sheet(-1)!B11 so I can copy a sheet. RonMc5 Excel Discussion (Misc queries) 9 February 3rd 05 12:51 AM


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