What is the color code of Bad and Good Highlights in Excel VBA?

enter image description here

I tried a search with glasses, but could not find a suitable keyword to find it. Does anyone know what color code I need to use in Excel VBA to get this?

+4
source share
1 answer

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
+3
source

Source: https://habr.com/ru/post/1531586/


All Articles