How do I display certain lines depnding on a cell critrera

G

Greg S

I have two options to select from and only one of the options can be
selected, lets call it A1 and A2.

If a person selects A1, I would like to view only lines 10 - 20, however if
a person selects A2, I would like to view only lines 20 - 40.

Greg
 
M

Mike H

Hi,

right click your sheet tab, view code and paste this in and try selecting 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


Mike
 

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