So, the macro recorder gives you this code:
Sub Macro2()
Range("A1").Select
Selection.Style = "Good"
Range("B1").Select
Selection.Style = "Bad"
End Sub
The next step is to get the color:
MsgBox Range("A1").Interior.Color ' returns 13561798
MsgBox Range("B1").Interior.Color ' returns 13551615
and finally, when you know the color, you can do this:
Range("A1:A10").Interior.Color = 13561798 ' for Good style
Range("B1:B10").Interior.Color = 13551615 ' for Bad style
source
share