Filling a cell with Character depending on Highlight Colour of that cell

Copper Contributor

Hello All, 

If possible I would like a function/subroutine where if the cell is highlighted green (for example), then an "x" is put in the cell. 

Is this possible? 

1 Reply


Sub letterifcolor()

Dim i As Long

For i = 1 To 100

Select Case Cells(i, 1).Interior.ColorIndex

Case Is = 4
Cells(i, 1).Value = "X"
Case Is = 5
Cells(i, 1).Value = "Y"
Case Is = 6
Cells(i, 1).Value = "W"
Case Is = 7
Cells(i, 1).Value = "Z"

End Select

Next i

End Sub

You can create a macro. Each time you run the macro the results are updated.