
Originally Posted by
bjvick
Watersev, I can't figure out what you did.
It works with macro. Insert 1382 in cell D28 and put 20 in cell F28. It works as you described except only column "Machine ID" is coloured.
Private Sub worksheet_change(ByVal target As Range)
Dim x As Double, y As Long, icolor As Integer
If target.Count > 1 Or IsEmpty(target) Or Cells(target.Row, target.Column - 2) = "" Then Exit Sub
x = WorksheetFunction.SumIf([d:d], target.Offset(0, -2), [f:f])
If target.Column = 6 Then
If x >= 16 Then
y = target.Offset(0, -2).Value
Select Case x
Case 16 To 25: icolor = 6
Case Is > 25: icolor = 3
End Select
Application.ReplaceFormat.Interior.ColorIndex = icolor
Range("d7:d" & target.Row).Replace what:=y, replacement:=y, ReplaceFormat:=True
End If
End If
End Sub
Bookmarks