I have certain entries related to no. of months in column C. In column E, i want to write my name but at the time of writing, i want a reminder if value of corresponding cell in Column C is greater than 4 . Pls guide me ho to do it.
Private Sub Worksheet_Change(ByVal Target As Range)
' Exit if multiple cells updated at once
If Target.CountLarge > 1 Then Exit Sub
' Only run when a cell in column E is updated
If Target.Column = 5 Then
' Check to see if value in corresponding column C is greater than 4
If Target.Offset(0, -2).Value > 4 Then
MsgBox "Value in column C of this row is greater than 4!", vbOKOnly, "WARNING!"
End If
End If
End Sub
Just add another IF/THEN clause, like the first:Thank you so much !!and what if i have to check in both column C AND D to see that both have less than 4 and 9 rrespectively and receive a warning for either or both the cases?
Private Sub Worksheet_Change(ByVal Target As Range)
' Exit if multiple cells updated at once
If Target.CountLarge > 1 Then Exit Sub
' Only run when a cell in column E is updated
If Target.Column = 5 Then
' Check to see if value in corresponding column C is greater than 4
If Target.Offset(0, -2).Value > 4 Then
MsgBox "Value in column C of this row is greater than 4!", vbOKOnly, "WARNING!"
End If
If Target.Offset(0, -1).Value > 9 Then
MsgBox "Value in column D of this row is greater than 9!", vbOKOnly, "WARNING!"
End If
End If
End Sub