0
How to convert RGB to VBA color code?
How to convert RGB to vba color code? ( Example format: &H800FFFFFF&) this example above will be the output
12 odpowiedzi
+ 1
or maybe a colorpicker is more useful...
https://code.sololearn.com/WhQzZHGMJwbP/?ref=app
+ 2
Tibor Santa
maybe this?
https://www.thespreadsheetguru.com/vba/hex-color-codes-for-vba-userforms
https://morsagmon.com/blog/working-with-colors-in-excel-vba/
it's quirky, though...(from the second link above)
"
while the Hex representation of a color is constructed by joining the RGB codes for the Web, Excel constructs its color codes by joining the BGR codes.
"
https://stackoverflow.com/questions/6003324/how-do-i-get-the-corresponding-hex-value-of-an-rgb-color-in-excel-vba
+ 1
I am not familiar with the format shown in your question. Google does not find this specific value. Can you post a more specific example? How would you use this format?
In Visual Basic, there is an RGB function that takes three numbers 0-255 for red, green and blue, and converts it to a Long type that represents the color.
https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/rgb-function
and this article shows how you can convert the number back to red, green and blue values, involves only simple division and modulo operations.
https://nolongerset.com/convertcolortorgb/
+ 1
Bob_Li good find, thanks!
"weird syntax" indeed. Why is Microsoft so bent on inventing their own standards? :)
+ 1
Tibor Santa
"some people just like to watch the world burn..." is their corporate slogan.🤨
+ 1
Hi guys chatGPT solved and helped me with my question that is the way I ask, 1st option to community 2nd option to AI... Thanks for your replies and provided sources.
+ 1
maybe late, but it's a good Python practice...
https://code.sololearn.com/cFDe30VD9dZR/?ref=app
+ 1
Thanks bro, will try this code
+ 1
You're awesome bro
0
Rhv Egge
you left out the custom color specifier "00" that you should add after the "&H". But yes, that's basically how it's done.
Nice bit of ad insert at the end, too...
(maybe a bot? It's getting harder and harder to tell real people from automated ad bots .. but joined 1 day before and already an ad...)
0
Html, css, js is awesome bro nice code bro thanks