Reset to full rows visible

M

Max

Trying the sub below from a Mike H post
How do I reset it to full rows visible if I were to click on a cell other
than A1 or A2?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Address
Case Is = ("$A$1")
Rows("10:20").EntireRow.Hidden = True
Rows("21:40").EntireRow.Hidden = False
Case Is = ("$A$2")
Rows("10:20").EntireRow.Hidden = False
Rows("21:40").EntireRow.Hidden = True
End Select
End Sub
 
G

Gary Keramidas

try this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Address
Case Is = ("$A$1")
Rows("10:20").EntireRow.Hidden = True
Rows("21:40").EntireRow.Hidden = False
Case Is = ("$A$2")
Rows("10:20").EntireRow.Hidden = False
Rows("21:40").EntireRow.Hidden = True
Case Else
Rows("10:40").EntireRow.Hidden = False
End Select
End Sub
 
D

Dave Peterson

Just from a user standpoint, I'd plop some buttons from the forms toolbar into
those cells and assign a macro to hide/unhide to each macro.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top