![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Location: Texas Instruments
Posts: 47
|
I don't know if this would be useful to anyone, but I had to find out how to match the background color of controls on my spreadsheet to the sheet's fill color and here's what I learned about the color format:
Making background color values of controls match the spreadsheet fill color. 1. Fill spreadsheet with color of your choice from indexed colors 2. Find out which index color it is ?ActiveWorkbook.ActiveSheet.Range("a1").interior.colorindex =33 3. Find out the long decimal value for the color ?activeworkbook.Colors(33) =16763904 4. Convert the decimal number to hex using the windows calculator app. =FFCC00 5. Add padding byte 00 to start of the hex number =00FFCC00 6. Add VB hex signifier &H before and & after the number 7. Paste the value into the background property of the controls on the worksheet. Number format: &H00000000& ^^ padding Colors are entered as BGR order not RGB RGB to long hex conversion: Color RGB(0,204,255) Dec Hex Red 0 00 Green 204 CC Blue 255 FF Result: &H00FFCC00& |
|
|
|
|
|
#2 |
|
New Member
Join Date: Feb 2002
Location: Texas Instruments
Posts: 47
|
Please excuse the formatting problem of my post. The tabs didn't show up correctly.
I suppose a person could also alter a color in the pallete to match the control's background color. |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
Thanks for sharing this. One thing (To save you one step), instead of ColorIndex use Color, like this:
Range("A1").Interior.Color which would return the Long value of the color. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|