RGB Value of Textbox1.BackColor which is equivalent to &H0080C0FF&

NimishK

Well-known Member
Joined
Sep 4, 2015
Messages
688
Hi

if selected the backcolor of Textbox1 which is &H0080C0FF&
Can any one tell me its RGB Value

Thanks
NimishK
 
Last edited:

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
The function below returns (255,192,128)
( Credit https://officetricks.com/convert-excel-vba-color-codes-rgb-hex/ )

Code:
Sub Test()
    MsgBox VBA_Hex_To_RGB("[COLOR=#ff0000]H0080C0FF[/COLOR]")
End Sub

Function VBA_Hex_To_RGB(hColor As String) As String
    Dim iRed, iGreen, iBlue
'Convert HEx to RGB
    hColor = VBA.Replace(hColor, "#", "")
    hColor = VBA.Right$("000000" & hColor, 6)
    iBlue = VBA.Val("&H" & VBA.Mid(hColor, 1, 2))
    iGreen = VBA.Val("&H" & VBA.Mid(hColor, 3, 2))
    iRed = VBA.Val("&H" & VBA.Mid(hColor, 5, 2))
'Return RGB Code
    VBA_Hex_To_RGB = "(" & iRed & "," & iGreen & "," & iBlue & ")"
End Function

This may also be useful - Hex value of background colour in active cell
Code:
MsgBox Right("000000" & Hex(ActiveCell.Interior.Color), 6)

An excellent site about colours http://dmcritchie.mvps.org/excel/colors.htm
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,149
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top