Fill in cells based on defined cell colour (public)

PHOTO EMBED

Wed Sep 08 2021 04:24:08 GMT+0000 (UTC)

Saved by @Darkleech #vba

Sub AddorChangeCellValueBasedOnCellColor() ' Fill in cells based on defined cell colour
    Dim rg As Range
    Dim xRg As Range
    Set xRg = Selection.Cells
    Application.DisplayAlerts = False
    For Each rg In xRg
        With rg
            Select Case .Interior.Color
                Case Is = RGB(255, 0, 0) 'Red
                    .Value = "Remove" 'Can simply replace with number
                Case Is = RGB(146, 208, 80) 'Light Green
                    .Value = "Add" 'Can also replace the Add simply replace with number no quotation marks
            End Select
        End With
    Next
    Application.DisplayAlerts = False
End Sub
content_copyCOPY