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!
 

Some videos you may like

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

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
365
Platform
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,088
Office Version
365, 2010
Platform
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
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,580
Messages
5,512,174
Members
408,882
Latest member
Clarab9

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top