ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I display certain lines depnding on a cell critrera (https://www.excelbanter.com/excel-worksheet-functions/206408-how-do-i-display-certain-lines-depnding-cell-critrera.html)

Greg S[_2_]

How do I display certain lines depnding on a cell critrera
 
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


Mike H

How do I display certain lines depnding on a cell critrera
 
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

"Greg S" wrote:

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



All times are GMT +1. The time now is 06:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com