Dear all,
I'm writing codes with as result that certain columns should be hidden when a specific choice is made in the drop down list.
Underneath the codes I use, which are very much simplified. In my real excel I have 7 in stead of 3 possibilities, and much much more columns to be hidden or to be shown.
Thanks a lot for helping me out!
CODE:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$2" Then
If LCase(Target.Text) = "All" Then
Columns("C").EntireColumn.Hidden = False
Columns("D").EntireColumn.Hidden = True
Columns("E").EntireColumn.Hidden = False
ElseIf LCase(Target.Text) = "Comptes bancaires" Then
Columns("C").EntireColumn.Hidden = True
Columns("D").EntireColumn.Hidden = False
Columns("E").EntireColumn.Hidden = False
ElseIf LCase(Target.Text) = "Terms deposit" Then
Columns("C").EntireColumn.Hidden = False
Columns("D").EntireColumn.Hidden = False
Columns("E").EntireColumn.Hidden = True
End if
End if
End sub
I'm writing codes with as result that certain columns should be hidden when a specific choice is made in the drop down list.
Underneath the codes I use, which are very much simplified. In my real excel I have 7 in stead of 3 possibilities, and much much more columns to be hidden or to be shown.
Thanks a lot for helping me out!
CODE:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$2" Then
If LCase(Target.Text) = "All" Then
Columns("C").EntireColumn.Hidden = False
Columns("D").EntireColumn.Hidden = True
Columns("E").EntireColumn.Hidden = False
ElseIf LCase(Target.Text) = "Comptes bancaires" Then
Columns("C").EntireColumn.Hidden = True
Columns("D").EntireColumn.Hidden = False
Columns("E").EntireColumn.Hidden = False
ElseIf LCase(Target.Text) = "Terms deposit" Then
Columns("C").EntireColumn.Hidden = False
Columns("D").EntireColumn.Hidden = False
Columns("E").EntireColumn.Hidden = True
End if
End if
End sub