Define list of worksheets

J

Judy Ward

I have an excel file with a dozen worksheets. I can run my Delete_Columns
function on all of the worksheets with this command:

Dim wks As Object
For Each wks In Worksheets
wks.Activate
Delete_Columns
Next wks

My problem is that I want to run this function on all the worksheets except
one ("History"). Is there a way to either exclude one worksheet or to define
the list of worksheets (IR_5, IR_6, IR_6_1, IR_7, IR_8, IR_9, IR_10, IR_11,
IR_any, IR_TBD, Doc_Only)?

Thank you for any help you can give me,
Judy
 
R

Ron de Bruin

Try this Judy

Dim wks As Object
For Each wks In Worksheets
If wks.Name <> "History" Then
wks.Activate
Delete_Columns
End If
Next wks
 
B

bj

try

Dim wks As Object
For Each wks In Worksheets
wks.Activate
if wks.name<>"History" then Delete_Columns
Next wks
 
R

Ron Coderre

If you just want to exclude the "History" worksheet:

Dim wks As Object
For Each wks In Worksheets
if wks.Name <> "History" Then
wks.Activate
Delete_Columns
End If
Next wks

Does that help?
 
Top