Function CellColor() As String
CellColor = GetRGB(ActiveCell.Interior.Color)
End Function
Function GetRGB(RGB As Long) As String
Dim HexString As String
Dim r As Double, g As Double, b As Double
HexString = Hex(RGB)
HexString = Right(String$(5, "0") & HexString, 6)
r = CDbl("&H" & Mid$(HexString, 5, 2))
g = CDbl("&H" & Mid$(HexString, 3, 2))
b = CDbl("&H" & Mid$(HexString, 1, 2))
GetRGB = "RGB(" & r & ", " & g & ", " & b & ")"
End Function
Function CellColor() As String
CellColor = GetRGB(ActiveCell.Interior.Color)
End Function
Function GetRGB(RGB As Long) As String
Dim HexString As String
Dim r As Double, g As Double, b As Double
HexString = Hex(RGB)
HexString = Right(String$(5, "0") & HexString, 6)
r = CDbl("&H" & Mid$(HexString, 5, 2))
g = CDbl("&H" & Mid$(HexString, 3, 2))
b = CDbl("&H" & Mid$(HexString, 1, 2))
GetRGB = "RGB(" & r & ", " & g & ", " & b & ")"
End Function
Function CellColor(Cell As Range) As String
CellColor = Cell.Interior.ColorIndex
End Function
There's a custom function ColorIndexOfOneCell that you can use here:
http://www.cpearson.com/Excel/colors.aspx