View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Apply Macro to all worksheets in a workbook except one

Sometimes, it's better to ignore upper/lowercase, too:

Option Explicit
Sub Apply_to_all_sheets()
dim ws as worksheet
For Each ws In Worksheets
if lcase(ws.name) < lcase("Sheet1") then
Call Begin
end if
Next ws
End Sub

And if you ever have to add a few more sheet names, you may want to look at
"Select case"

Option Explicit
Sub Apply_to_all_sheets2()
dim ws as worksheet
For Each ws In Worksheets
select case lcase(ws.name)
case is = lcase("sheet1"), lcase("sheet99"), lcase("sheet33")
'do nothing
case else
Call Begin
end select
Next ws
End Sub

"Carrie_Loos via OfficeKB.com" wrote:

Is there a way to include an exception to this macro so that it excludes
Sheet1??

Sub Apply_to_all_sheets()

For Each ws In Worksheets
Call Begin
Next
End Sub

Thanks for any help
Carrie

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200901/1


--

Dave Peterson