Hiding Rows based on Tab

gavakie

New Member
Joined
Jun 13, 2011
Messages
1
Can I hide rows based on a tab being hidden. What im looking to do is if a tab is hidden on another tab where Im getting that info from I want that row to hide its self.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Welcome to the board gavakie,

If I am reading you correctly you want to hide a row or set of rows on one sheet if another sheet is hidden. Example if Sheet2 is hidden on Sheet1 hide rows 1 to 10.

Code:
Sub rowHideBySheet()

   '// Rows to hide are on Sheet1
    With Sheets("Sheet1")
        .Rows("1:10").EntireRow.Hidden = Not (Sheets("Sheet2").Visible)
        .Rows("11:20").EntireRow.Hidden = Not (Sheets("Sheet3").Visible)
    End With

End Sub

The above will both hide and unhide depending on sheet visibility. You just have to change the sheet names and rows to match you application.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,561
Messages
6,179,521
Members
452,923
Latest member
JackiG

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