Addisonian
New Member
- Joined
- Oct 8, 2021
- Messages
- 8
- Office Version
- 365
- Platform
- Windows
My VBA knowledge is very fresh and I imagine that shows in the code below. I have used the below code before to hide and unhide columns based on a small dropdown list. The list I am working off of here is a dropdown of a dropdown which means the total amount of columns I am looking at is 80+ and will continue to grow.
What I am trying to do is more or less is:
Hide columns (L:CU)=True [with the easy ability to move CU down the line] unless "row 7" of a column equals Target.Address (cell "I3")
Ideally done off a change event.
Thanks for any help.
What I am trying to do is more or less is:
Hide columns (L:CU)=True [with the easy ability to move CU down the line] unless "row 7" of a column equals Target.Address (cell "I3")
Ideally done off a change event.
VBA Code:
If Target.Address = ("$I$3") Then
If Target.Text = "Countryside" Then
Columns("M:CT").EntireColumn.Hidden = True
Columns("M").EntireColumn.Hidden = False
ElseIf Target.Text = "Yorktown" Then
Columns("M:CT").EntireColumn.Hidden = True
Columns("N").EntireColumn.Hidden = False
ElseIf Target.Text = "McLean" Then
Columns("M:CT").EntireColumn.Hidden = True
Columns("O").EntireColumn.Hidden = False
ElseIf Target.Text = "Bella Vista Traditional" Then
Columns("M:CT").EntireColumn.Hidden = True
Columns("P").EntireColumn.Hidden = False
ElseIf Target.Text = "New Haven" Then
Columns("M:CT").EntireColumn.Hidden = True
Columns("Q").EntireColumn.Hidden = False
Thanks for any help.