Hello,
I have a requirement where in a message needs to be displayed based on the cell value in the sheet which works as expected which is below.
Now, I need another check and message to be displayed based on a different cell value when the value changes which is the second section of the code that doesn't work. Can anyone please suggest how can we have multiple checks in Worksheet_Change Sub.
I have a requirement where in a message needs to be displayed based on the cell value in the sheet which works as expected which is below.
Now, I need another check and message to be displayed based on a different cell value when the value changes which is the second section of the code that doesn't work. Can anyone please suggest how can we have multiple checks in Worksheet_Change Sub.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$D$2" Then
If Target.Value = "Yes" Then
MsgBox "Check required."
ElseIf Target.Value = "No" Then
MsgBox "Check not required"
End If
End If
If Target.Address = "$E$2" Then
If Target.Value = "Yes" Then
MsgBox "Total > 500"
ElseIf Target.Value = "No" Then
MsgBox "Total < 500"
End If
End If
End Sub