Hi! I hava a problem with macro. Can you help me please?
I need to hide / unhide columns depending on dropdown list value in cell B2.
error message is: BASIC runtime error. ‘91’ Object variable not set.
In this row:
If Target.Column = 2 And Target.Row =
3 Then
Hole macro looks like this:
Option VBASupport 1
Option Compatible
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 And Target.Row = 2 Then
If Target.Value = "No" Then
Application.Columns("C:I").Select
Application.Selection.EntireColumn.Hidden = True
ElseIf Target.Value = "Yes" Then
Application.Columns("C:I").Select
Application.Selection.EntireColumn.Hidden = False
End If
End If
End Sub