Hi all
I am trying following code to hide/ unhide columns based on value in cell A1 but it's giving error "Function or Sub not defined"
please help
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Changed As Range
Set Changed = Range("A1")
If Not Intersect(Target, Changed) Is Nothing Then
Range("B:FF").EntireColumn.Hidden = False
Select Case UCase(Target.Value)
Case "40"
Range("AQ:FF").EntireColumn.Hidden = True
Case "120"
Range("CF:FF").EntireColumn.Hidden = True
Case "160"
Range("DQ:FF").EntireColumn.Hidden = True
End Select
End If
Set Changed = Nothing
End Sub
cell A1 is a dropdown list
am not able to find the reason.
Thanks
I am trying following code to hide/ unhide columns based on value in cell A1 but it's giving error "Function or Sub not defined"
please help
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Changed As Range
Set Changed = Range("A1")
If Not Intersect(Target, Changed) Is Nothing Then
Range("B:FF").EntireColumn.Hidden = False
Select Case UCase(Target.Value)
Case "40"
Range("AQ:FF").EntireColumn.Hidden = True
Case "120"
Range("CF:FF").EntireColumn.Hidden = True
Case "160"
Range("DQ:FF").EntireColumn.Hidden = True
End Select
End If
Set Changed = Nothing
End Sub
cell A1 is a dropdown list
am not able to find the reason.
Thanks
Last edited: