74Pumpkin
11-21-2004, 07:53 PM
I currently have the following to hide and unhide the areas I want to view. I only need to see 14 or so of the 400+ rows. I would like to be able to do this with a dropdown box if possable.
My failed attempt was to make a dropdown box put the values into cell G3. But this would not activate the code.
The following works good when you type the number in cell G3
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$G$3" Then
Select Case Target.Value
Case 1
Rows("26:405").EntireRow.Hidden = True
Rows("12:25").EntireRow.Hidden = False
Range("H12").Select
Range("G3").Select
Case 2
Rows("12:25").EntireRow.Hidden = True
Rows("26:39").EntireRow.Hidden = False
Rows("40:405").EntireRow.Hidden = True
Range("G3").Select
Case 3
Rows("12:39").EntireRow.Hidden = True
Rows("40:53").EntireRow.Hidden = False
Rows("54:405").EntireRow.Hidden = True
Range("G3").Select
Case 4
Rows("12:53").EntireRow.Hidden = True
Rows("54:67").EntireRow.Hidden = False
Rows("68:405").EntireRow.Hidden = True
Range("H54").Select
Range("G3").Select
Case 5
Rows("12:67").EntireRow.Hidden = True
Rows("68:81").EntireRow.Hidden = False
Rows("82:405").EntireRow.Hidden = True
Range("H68").Select
Range("G3").Select
' This continues on to #27
Any ideas would help.
BTW. I am a newbie to VBA.( If it wasn;t obvious that is)
My failed attempt was to make a dropdown box put the values into cell G3. But this would not activate the code.
The following works good when you type the number in cell G3
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$G$3" Then
Select Case Target.Value
Case 1
Rows("26:405").EntireRow.Hidden = True
Rows("12:25").EntireRow.Hidden = False
Range("H12").Select
Range("G3").Select
Case 2
Rows("12:25").EntireRow.Hidden = True
Rows("26:39").EntireRow.Hidden = False
Rows("40:405").EntireRow.Hidden = True
Range("G3").Select
Case 3
Rows("12:39").EntireRow.Hidden = True
Rows("40:53").EntireRow.Hidden = False
Rows("54:405").EntireRow.Hidden = True
Range("G3").Select
Case 4
Rows("12:53").EntireRow.Hidden = True
Rows("54:67").EntireRow.Hidden = False
Rows("68:405").EntireRow.Hidden = True
Range("H54").Select
Range("G3").Select
Case 5
Rows("12:67").EntireRow.Hidden = True
Rows("68:81").EntireRow.Hidden = False
Rows("82:405").EntireRow.Hidden = True
Range("H68").Select
Range("G3").Select
' This continues on to #27
Any ideas would help.
BTW. I am a newbie to VBA.( If it wasn;t obvious that is)