Only hide rows on open

flavioso

New Member
Joined
Oct 29, 2008
Messages
20
Hello. In my sheet activate code, I have a series of rows hidden, as shown below.

Code:
Private Sub Worksheet_Activate()
Range("16:364").Select
Selection.EntireRow.Hidden = True
'Hides everything when the sheet opens
End Sub

I have check box controls that if a user clicks in a specific check box, it unhides a certain set of rows. I would like to know if there is anyway that should I go to another sheet, and come back to the master sheet, that it doesn't go back and re-hide the whole range again. Basically, I only want all rows hidden when the worksheet is opened the first time, but any additional focus set to the master page, doesn't "re-activate". Is there anyway to do this?

Or, better yet, it leaves it as it was before I switched to another sheet, (i.e. meaning the current rows hidden/current rows shown)

I appreciate any advice.

Brad
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
You could record in a hidden cell whether the worksheet has previosuly been activated and check that cell in your worksheet activate code. Something like this:

Code:
Private Sub Worksheet_Activate()
    If Range("AA1").Value = "Yes" Then          ' you can hide columnAA so no one sees this
        ' worksheet has already been activated
        Exit Sub
    Else
        ' worksheet has never been activated before so record first activation
        Range("AA1").Value = "Yes"
        'Hides everything when the sheet opens
        Range("16:364").EntireRow.Hidden = True
    End If
        
End Sub
 
Upvote 0
When you talk like, saying, it's really hard to, this, understand what you're.

Public Toggle

Private Static Sub Worksheet_Active()

If Toggle = False
Rows.Hide
Toggle = True
Else
End If

End Sub

Probably something along those lines.
 
Upvote 0

Forum statistics

Threads
1,216,575
Messages
6,131,501
Members
449,654
Latest member
andz

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