Hide/shows raw based on drop down menue

Y

Yonni

Hi,

i've going through all relevant information but cant make my excel wor
for me :(. If somebody can help???

I have drop-down menue with 7 different inputs in it/ I want to be abl
pick 1 and table 1 will shows up...pick 2 and table 2 will shows up..

I dont want to see anything else, but correlation between value i
dropdown menue and table ( all other tables should be hidden)

My drop down menu - D16

My table one from row: 19-31
Table 2 from -33- 50
Table 3 from - 51 60
Table 4 from - 61 65
Table 5 from - 67 - 70
Table 6 from - 72 -75
Table 7 from - 77-81

Please, help me...I need to make it work

Thank you in advance,
Yonni
 
I

isabelle

hi Yonnie,

Private Sub ComboBox1_Change()
With Sheets(1) ' adapt sheet
.Cells.EntireRow.Hidden = False
Select Case Me.ComboBox1.ListIndex
Case 0: .Rows("1:18").EntireRow.Hidden = True: .Rows("32:" & .Rows.Count).EntireRow.Hidden = True
Case 1: .Rows("1:32").EntireRow.Hidden = True: .Rows("51:" & .Rows.Count).EntireRow.Hidden = True
Case 2: .Rows("1:50").EntireRow.Hidden = True: .Rows("61:" & .Rows.Count).EntireRow.Hidden = True
Case 3: .Rows("1:60").EntireRow.Hidden = True: .Rows("66:" & .Rows.Count).EntireRow.Hidden = True
Case 4: .Rows("1:66").EntireRow.Hidden = True: .Rows("71:" & .Rows.Count).EntireRow.Hidden = True
Case 5: .Rows("1:71").EntireRow.Hidden = True: .Rows("76:" & .Rows.Count).EntireRow.Hidden = True
Case 6: .Rows("1:76").EntireRow.Hidden = True: .Rows("82:" & .Rows.Count).EntireRow.Hidden = True
End Select
End With
End Sub




--
isabelle



Le 2012-01-19 17:55, Yonni a écrit :
 
D

Don Guillett

something like this using select case. Right click sheet tab>view
code>insert this

Private Sub Worksheet_Change(ByVal Target As Range)
Dim x As Long
Dim y As Long
If Target.Count > 1 Or _
Target.Address <> Range("d16").Address Then Exit Sub
Rows("19:81").Hidden = False
Select Case Target 'Range("d16")
Case Is = 1: x = 19: y = 31
Case Is = 2: x = 33: y = 50
Case Is = 3: x = 51: y = 60
'you modify the others
'Case Is = 1: x = 19: y = 31
'Case Is = 1: x = 19: y = 31
'Case Is = 1: x = 19: y = 31
'Case Is = 1: x = 19: y = 31
Case Else
End Select
Rows(x & ":" & y).Hidden = True
End Sub
 

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