Looping Through Array of Worksheets

dallin01

Board Regular
Joined
Sep 16, 2009
Messages
61
Can someone help me identify why the follow code doesn't loop through each worksheets?

Dim ws As Worksheet
For Each ws In Sheets(Array("qmr2", "qmr3", "qmr4", "qmr6", "qmr9", "qmr10", "qmr2M", "qmr3M", _
"qmr2q", "qmr2qly", "qmr2a", "qmr2aly", "qmr3a", "qmr3ac", "qmr3ly", "qmr3lyEnd", "qmr4a", _
"qmr4aly", "qmr9a", "qmr10a", "qmrep2", "qmrep3", "qmrep4", "qmrep6", "qmrep6DDA", "qmrep2a", _
"qmrep2aly", "qmrep3a", "qmrep3ac", "qmrep4a", "qmrep6a", "qmrep6aly", "qm2", "qm3", "qm4", "qm6", _
"qt2", "qt3", "qt4", "qt6", "qr2", "qr3", "qr4", "qr6", "qp2", "qp3", "qp4", "qp6", "qu2", _
"qu3", "qu4", "qu6", "qa2", "qa3", "qa4", "qa6", "qetc2", "qetc3", "qetc4", "qetc6", "qetc9", _
"qetc10", "qet2", "qet3", "qet4", "qet6", "qet9", "qet10", "clcrk2", "clcrk3", "clcrk4", "qgmc2", _
"qgmc3", "qgmc4", "qgmc6", "qgmc10", "qgm2", "qgm3", "qgm4", "qgm6", "qgm10", "rgs2", "rgs3", "rgs4", _
"rgs6", "rgs10", "rp2", "rp3", "rp4", "rp6", "rp10", "qsi2", "qsi3", "qsi4", "mr2", "mr3", "mr4", _
"wx4"))
With ws
Rows("6:200").Select
Selection.EntireRow.Hidden = False
Cells(4, 1).Select
End With
Next ws

For Each ws In Sheets(Array("qgmc11", "qgm11"))
With ws
Rows("6:300").Select
Selection.EntireRow.Hidden = False
Cells(4, 1).Select
End With
Next ws
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Either activate each sheet, or don't select:

ws.Rows("6:200").EntireRow.Hidden = False

See how that works
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,628
Members
452,933
Latest member
patv

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