Color cells based on cell number

Copper Contributor

Hello 

 

I have cell numbers in a worksheet (sheet1)  - these number will change day to day:

 

A222

C467

E444

 

I need to find those cells in another worksheet (sheet2) and make them red.

 

What is the best way to do this?

1 Reply

@jthorpe222 

Sub colorcellsred()

    Dim sheet1 As Worksheet
    Dim sheet2 As Worksheet
    Dim i As Long
    Dim j As Long

    Set sheet1 = Worksheets("Tabelle1")
    Set sheet2 = Worksheets("Tabelle2")
    j = sheet1.Range("A" & Rows.Count).End(xlUp).Row
    For i = 3 To j
        sheet2.Range(sheet1.Range("A" & i).Value).Interior.ColorIndex = 3
    Next i

End Sub

Maybe with this code. In the attached file you can click the button in cell C2 to start the macro.