Hi I'm looking to use VBA to hide columns based on the values inputted into a series of dropdown menus.
Each menu asks "Yes" or "No" to whether to include a characteristic which maps to a specific column. The dropdowns are located on the REPORT SET UP worksheet whereas the columns to be displayed or hidden are on the INCOME STATEMENT worksheet.
I'm trying to get this code to work:
1 Private Sub Worksheet_Change(ByVal Target As Range)
2
3 If Target.Column = 2 And Target.Row = 4 Then
4 If Target.Value = "No" Then
5 Application.Worksheets("INCOME STATEMENT").Columns("C:O").Select
6 Application.Selection.EntireColumn.Hidden = True
7 ElseIf Target.Value = "Yes" Then
8 Application.Columns("C:O").Select
9 Application.Selection.EntireColumn.Hidden = False
10 End If
11 End If
12 End Sub
This is tripping up on the 5th line currently. Any help would be greatly appreciated.
Bookmarks