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

8th Jun 2023, 2:36 AM
Yamo
Yamo - avatar
12 ответов
+ 1
or maybe a colorpicker is more useful... https://code.sololearn.com/WhQzZHGMJwbP/?ref=app
8th Jun 2023, 3:36 PM
Bob_Li
Bob_Li - avatar
+ 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
8th Jun 2023, 12:46 PM
Bob_Li
Bob_Li - avatar
+ 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/
8th Jun 2023, 4:28 AM
Tibor Santa
Tibor Santa - avatar
+ 1
Bob_Li good find, thanks! "weird syntax" indeed. Why is Microsoft so bent on inventing their own standards? :)
8th Jun 2023, 12:57 PM
Tibor Santa
Tibor Santa - avatar
+ 1
Tibor Santa "some people just like to watch the world burn..." is their corporate slogan.🤨
8th Jun 2023, 1:15 PM
Bob_Li
Bob_Li - avatar
+ 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.
8th Jun 2023, 1:51 PM
Yamo
Yamo - avatar
+ 1
maybe late, but it's a good Python practice... https://code.sololearn.com/cFDe30VD9dZR/?ref=app
8th Jun 2023, 2:07 PM
Bob_Li
Bob_Li - avatar
+ 1
Thanks bro, will try this code
8th Jun 2023, 2:33 PM
Yamo
Yamo - avatar
+ 1
You're awesome bro
9th Jun 2023, 12:12 AM
Yamo
Yamo - avatar
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...)
9th Jun 2023, 6:15 AM
Bob_Li
Bob_Li - avatar
0
Html, css, js is awesome bro nice code bro thanks
13th Jun 2023, 11:16 AM
Yamo
Yamo - avatar