FlavioMorrone
New Member
- Joined
- Mar 5, 2018
- Messages
- 2
Hi everybody,
I am trying to run the following coding in the macro:
My goal is to hide columns from L to P based on the selection on the dropdown list in cell D2. However, by running the code, I bump into a series of problems:
Would like to ask for help to solve these two issues, thank you so much in advance!
I am trying to run the following coding in the macro:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 And Target.Row = 2 And Target.Value = "5" Then
Application.Columns("L:P").Select
Application.Selection.EntireColumn.Hidden = True
Else
Application.Columns("L:P").Select
Application.Selection.EntireColumn.Hidden = False
End If
End Sub
My goal is to hide columns from L to P based on the selection on the dropdown list in cell D2. However, by running the code, I bump into a series of problems:
- A window pops out saying "Error 13 run-time" everytime I insert or delete any row
- Many times, while working on the Excel sheet, I automatically happen to select the columns L:P even against my will, and this turns out to be quite annoying.
Would like to ask for help to solve these two issues, thank you so much in advance!