Barry.Burke
New Member
- Joined
- Sep 9, 2012
- Messages
- 5
Hello
I have a list box (Listbox2) that I would like to hide a row on a different sheet based on the selections made. I have tried a number of codes and the closest I can get is to hide all of the rows regardless of the selection.
List box references: "a","b","c"
Rows to be hidden: "a" - Sheets("Lead and Lag Indicators BU") - Cell Ref "A26"
Rows to be hidden: "b" - Sheets("Lead and Lag Indicators BU") - Cell Ref "A27"
Rows to be hidden: "c" - Sheets("Lead and Lag Indicators BU") - Cell Ref "A28"
Basically I want to be able click on "a" and hide the whole of row 26, "b" hide row 27 etc.
This is the closest I have been able to get
Sub HideRows_Click()
Dim a As Long
Sheets("Lead and Lag Indicators BU").Select
Range("A26", "A31").EntireRow.Hidden = True
Sheets("Dashboard").Select
End Sub
Private Sub ListBox2_Change()Call HideRows_Click
End Sub
Any help would be appreciated.
Thanks
Barry
I have a list box (Listbox2) that I would like to hide a row on a different sheet based on the selections made. I have tried a number of codes and the closest I can get is to hide all of the rows regardless of the selection.
List box references: "a","b","c"
Rows to be hidden: "a" - Sheets("Lead and Lag Indicators BU") - Cell Ref "A26"
Rows to be hidden: "b" - Sheets("Lead and Lag Indicators BU") - Cell Ref "A27"
Rows to be hidden: "c" - Sheets("Lead and Lag Indicators BU") - Cell Ref "A28"
Basically I want to be able click on "a" and hide the whole of row 26, "b" hide row 27 etc.
This is the closest I have been able to get
Sub HideRows_Click()
Dim a As Long
Sheets("Lead and Lag Indicators BU").Select
Range("A26", "A31").EntireRow.Hidden = True
Sheets("Dashboard").Select
End Sub
Private Sub ListBox2_Change()Call HideRows_Click
End Sub
Any help would be appreciated.
Thanks
Barry