Unhiding rows across worksheets at once

nmdks3

New Member
Joined
Feb 22, 2008
Messages
11
I am trying to unhide a range of rows across several worksheets in the same book at once. Here is the code I have:

Sheets(Array("AUG", "SEP", "OCT", "Q1", "NOV", "DEC", "JAN", "Q2", "FALL", "FALL2")).Select
Sheets("AUG").Activate

' Show regular departments
Range("9:30,222:247").Select
Range("A9").Activate
Selection.EntireRow.Hidden = False

Currently, it is only unhiding the rows on the "AUG" tab. Any suggestions? All help is appreciated!
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
Sub testb()
Dim ws As Worksheet
For Each ws In Sheets(Array("AUG", "SEP", "OCT", "Q1", "NOV", "DEC", "JAN", "Q2", "FALL", "FALL2"))
    ws.Rows("9:30,222:247").Hidden = False
Next ws
End Sub
 

Fowmy

Well-known Member
Joined
Jul 10, 2008
Messages
512
Office Version
  1. 365
Platform
  1. Windows
Edit this line

Range("9:30,222:247").EntireRow.Hidden = False
 

nmdks3

New Member
Joined
Feb 22, 2008
Messages
11
Thanks for all of your help! Got it working the way I want now!
 

Nalani

Well-known Member
Joined
Apr 10, 2009
Messages
1,047

ADVERTISEMENT

What did you end up with?

This line in your orginal code;
Code:
Sheets("AUG").Activate
was ungrouping your sheets if Sheets AUG was not the active sheet when you ran your code.

That is why you were experienceing the code working on only that sheet.
 

nmdks3

New Member
Joined
Feb 22, 2008
Messages
11
I used Fowmy's suggestion, and it worked once. Now that I am testing it in other sections, it's not working again.
 

nmdks3

New Member
Joined
Feb 22, 2008
Messages
11

ADVERTISEMENT

Here's what I have now...


Sheets(Array("AUG", "SEP", "OCT", "Q1", "NOV", "DEC", "JAN", "Q2", "FALL", "FALL2")).Select
Range("32:59,249:281,435:435").EntireRow.Hidden = False
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
At the risk of repetition

Code:
Sub testb()
Dim ws As Worksheet
For Each ws In Sheets(Array("AUG", "SEP", "OCT", "Q1", "NOV", "DEC", "JAN", "Q2", "FALL", "FALL2"))
    ws.Rows("32:59,249:281,435:435").Hidden = False
Next ws
End Sub
 

nmdks3

New Member
Joined
Feb 22, 2008
Messages
11
That code errors out with a Type Mismatch...


Dim ws As Worksheet
For Each ws In Sheets(Array("AUG", "SEP", "OCT", "Q1", "NOV", "DEC", "JAN", "Q2", "FALL", "FALL2"))
ws.Rows("32:59,249:281,435:435").Hidden = False
Next ws
</pre>
 

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,913
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
That code errors out with a Type Mismatch...


Dim ws As Worksheet
For Each ws In Sheets(Array("AUG", "SEP", "OCT", "Q1", "NOV", "DEC", "JAN", "Q2", "FALL", "FALL2"))
ws.Rows("32:59,249:281,435:435").Hidden = False
Next ws
I think Peter dropped a property:
Rich (BB code):
ws.Rows("32:59,249:281,435:435").EntireRow.Hidden = False
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,448
Messages
5,837,306
Members
430,494
Latest member
abhi_is_yours

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
Top