Hi MIGARDEIN,
Please try this,
You may use vb constant colour to change your preferred colour
i.e. vbYellow, vbRed, VbBlue, etc. or customize colour using RGB (255,255,255) 'white
Sub test()
Dim ws As Worksheet
Dim Car As Range
Dim CountCAR1 As Long, CountCAR2 As Long
Dim rngColour As Variant
Set ws = Sheets("Sheet1")
Set Car = Range(ws.Cells(2, "A"), ws.Cells(Rows.Count, "A").End(xlUp))
For Each rngColour In Car.Offset(, 1)
If rngColour.Interior.Color = vbYellow And rngColour.Offset(, -1) = "CAR 1" Then
CountCAR1 = CountCAR1 + 1
End If
If rngColour.Interior.Color = vbYellow And rngColour.Offset(, -1) = "CAR 2" Then
CountCAR2 = CountCAR2 + 1
End If
Next rngColour
ws.Range("E2").Value = CountCAR1
ws.Range("E3").Value = CountCAR2
End Sub
If the above helped you, please add reputation to me
Bookmarks