ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Apply Macro to all worksheets in a workbook except one (https://www.excelbanter.com/excel-discussion-misc-queries/216649-apply-macro-all-worksheets-workbook-except-one.html)

Carrie_Loos via OfficeKB.com

Apply Macro to all worksheets in a workbook except one
 
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


Gary''s Student

Apply Macro to all worksheets in a workbook except one
 
Sub Apply_to_all_sheets()
Dim ws As Worksheet
For Each ws In Worksheets
If ws.Name = "Sheet1" Then
Else
Call begin
End If
Next
End Sub

--
Gary''s Student - gsnu2007k


"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



Luke M

Apply Macro to all worksheets in a workbook except one
 
Sub Apply_to_all_sheets()

For Each ws In Worksheets
If ws.name = "Sheet1" then goto xSkip
Call Begin
xSkip:
Next
End Sub

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"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



Mike H

Apply Macro to all worksheets in a workbook except one
 
Hi,

Sub Apply_to_all_sheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Name < "Sheet1" Then
Call begin
End If
Next
End Sub

Mike

"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



Tom Hutchins

Apply Macro to all worksheets in a workbook except one
 
Try

For Each ws In Worksheets
If ws.Name < "Sheet1" Then
Call Begin
End If
Next

Hope this helps,

Hutch

"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

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


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

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