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

NimishK

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

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

Thanks
NimishK
 
Last edited:

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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,215,030
Messages
6,122,762
Members
449,095
Latest member
m_smith_solihull

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