could you just use a IF statement and check the activeworksheets name
property. If it matches the name you do not want to have the macro attached
do nothing.
"Dave Peterson" wrote:
And if that list of worksheets gets longer, sometimes it's easier to see in the
Select case structu
Sub DoSomething2()
Dim wb As Workbook
Dim ws As Worksheet
Set wb = ActiveWorkbook
For Each ws In wb.Worksheets
select case lcase(ws.name)
case is = "source data", "anothersheet", "evenmore"
'do nothing
case else
'Do some thing here
End select
Next ws
Set wb = Nothing
End Sub
Make sure you type that list in lower case--that's what the select case is
looking at.
minrufeng wrote:
If I want to apply a macro to all sheets except for a certain sheet, say
sheet "source data", what should I do? Thank you for your help. below is
my current code. Thank you for your help!
Public Sub insertrowinallsheets()
Dim sheet As Variant
For Each sheet In ActiveWorkbook.Sheets
sheet.Cells.Find("CostClub").EntireRow.Insert
Next sheet
End Sub
--
minrufeng
------------------------------------------------------------------------
minrufeng's Profile: http://www.excelforum.com/member.php...o&userid=26208
View this thread: http://www.excelforum.com/showthread...hreadid=515068
--
Dave Peterson