G
gtslabs
Trigger Macro based on single Cell change
I have a range named "Method". it is only 1 cell and contains the Data
Validation Letters A,B,C,D and is used on the form as a dropdown list.
I want to trigger the following code based on the value (A,B,C or D).
Right now it uns every time I change any cell value in the worksheet.
Can this be done?
Private Sub Worksheet_Change(ByVal Target As Range)
If Me.Range("Method").Value = "D" Then
Rows("14:19").Select
Selection.EntireRow.Hidden = False
Rows("51:53").Select
Selection.EntireRow.Hidden = False
Else
Rows("51:53").Select
Selection.EntireRow.Hidden = True
Rows("14:19").Select
Selection.EntireRow.Hidden = True
End If
End Sub
I have a range named "Method". it is only 1 cell and contains the Data
Validation Letters A,B,C,D and is used on the form as a dropdown list.
I want to trigger the following code based on the value (A,B,C or D).
Right now it uns every time I change any cell value in the worksheet.
Can this be done?
Private Sub Worksheet_Change(ByVal Target As Range)
If Me.Range("Method").Value = "D" Then
Rows("14:19").Select
Selection.EntireRow.Hidden = False
Rows("51:53").Select
Selection.EntireRow.Hidden = False
Else
Rows("51:53").Select
Selection.EntireRow.Hidden = True
Rows("14:19").Select
Selection.EntireRow.Hidden = True
End If
End Sub