I am working on a project in which I need a series of values in the "B" column to be tested to see if each value entered is within the given range specified for that cell. If it is not then I would like the program to require some explanation to be entered in the adjacent "C" column.
Here is a Macro that does exactly what I want it to for "B16". I however cannot seem to get it to work for other values in the "B" column.
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B16")) Is Nothing Then Exit Sub
Dim CellVal
If (Target < 150 Or Target > 180) And IsEmpty(Target.Offset(0, 1)) Then
CellVal = InputBox("Oil Tempurature is Outside Suggested Range. Please Leave Comment (e.g. What corrective action was taken)")
If CellVal = vbNullString Then GoTo error
Target.Offset(0, 1) = CellVal
End If
error:
If (Target < 150 Or Target > 180) And IsEmpty(Target.Offset(0, 1)) Then
CellVal = InputBox("You must leave a Comment (e.g. What corrective action was taken)")
If CellVal = vbNullString Then GoTo error
Target.Offset(0, 1) = CellVal
End If
End Sub
please HELP!!
Bookmarks