JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,691
- Office Version
- 365
- Platform
- Windows
While working on a macro to do some highlighting, I had the need to change both the fill color and the font color. Using the macro recorder, I learned that I can set the fill color to red (255,0,0) using this code:
I then learned that I can set the font color to red using this code:
It turns out that -16776961 = 256^3 - the RGBcolor value.
Why is the font color not just the RGB value, like the fill color is?
Code:
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.color = 256
.TintAndShade = 0
.PatternTintAndShade = 0
End With
I then learned that I can set the font color to red using this code:
Code:
With Selection.Font
.color = -16776961
.TintAndShade = 0
End With
It turns out that -16776961 = 256^3 - the RGBcolor value.
Why is the font color not just the RGB value, like the fill color is?