Forum Discussion

bfin1075's avatar
bfin1075
Copper Contributor
Aug 24, 2023

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

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? 
Thanks!

1 Reply

  • bfin1075 

    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.

Resources