Loop through all worksheets with 2 exceptions

jaffacake

Board Regular
Joined
Oct 22, 2011
Messages
218
Hi all,

I have the following sub which i'm using to loop through my workbooks' worksheets;

Code:
Sub UpdateAllSheets()
Dim ws As Worksheet
Application.ScreenUpdating = False
DeleteCharts
For Each ws In Worksheets
If Not ws.Name = "Summary" Or Not ws.Name = "Raw Data" Then ws.Select
With ActiveSheet
ActiveWindow.Zoom = 75
Update
End With
Next ws
Application.ScreenUpdating = True
End Sub

However, the 'Update' is still being applied to both the Summary and Raw Data worksheets. Why is it not working?

Any help woukld be greatly appreciated.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
You need And instead of Or

Code:
If ws.Name <> "Summary" And ws.Name <> "Raw Data" Then ws.Select
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,378
Members
448,955
Latest member
BatCoder

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top