Forum Discussion
Brian_Wier
Jun 12, 2023Copper Contributor
Programming Cell Color Fill
How can i program a cell fill color to match an existing cell color (also include plus possible text)? example: The only constant is the B column. The A column is manually input, and changes...
OliverScheurich
Jun 12, 2023Gold Contributor
Sub colors()
Dim i, j, k As Long
Range("E:E").Clear
i = Range("D" & Rows.Count).End(xlUp).Row
For j = 1 To i
k = Application.Match(Cells(j, 4), Range(Cells(1, 1), Cells(10000, 1)), 0)
Cells(j, 5).Value = Cells(k, 2).Value
Cells(j, 5).Interior.ColorIndex = Cells(k, 2).Interior.ColorIndex
Next j
End Sub
You can try these lines of code. In the attached file you can click the button in cell G2 to run the macro.