Hi All,

I want to come up with a macro which when a user will select a cell and run that macro then the macro will give the RGB numbers of the color pattern which cell has in a msgbox. I have the below code so far. Please expedite.

Function RGB(CellRef As Variant)
RGB = ToHex(Range(CellRef).Interior.Color)
End Function

Function ToHex(ByVal N As Long) As String
strH = ""
For i = 1 To 6
d = N Mod 16
strH = Chr(48 + (d Mod 9) + 16 * (d \ 9)) & strH
N = N \ 16
Next i
ToHex = strH
End Function
Thanks a lot for your help in advance.