Thursday, February 6, 2014

VBA - Return the RGB Value of a Cell's Font

This returns the RGB values of cell A1:
sFontColor = Hex(Range("A1").Font.Color)
sFontColor = "000000" & sFontColor
sFontColor = Right(sFontColor, 6)
R = CInt("&H" & Right(sFontColor, 2))
G = CInt("&H" & Mid(sFontColor, 3, 2))
B = CInt("&H" & Left(sFontColor, 2))