Determining background color of cell, in &H0080FFFF& format?
I'm finding that the palette of the controls on the Control toolbar is not
the same as the background colors for workbook cells. How can I find the background color of a cell in the &H0080FFFF& format? Then I can, of course, simply enter that number in the control's property. Don <donwiss at panix.com. |
Determining background color of cell, in &H0080FFFF& format?
Instead of using .ColorIndex use only .Color
Though this will not return in the exact format you asked for, it will return the colour independent of the pallete. Try:- Dim myColor as Long myColor = Worksheets("Sheet1").Range("A5").Interior.Color MsgBox myColor Sharad *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Determining background color of cell, in &H0080FFFF& format?
Don
Here´s one way: Select the cell in question and run the below sub to get the interior color of the cell in the format &H00BBGGRR& Sub HexColor() 'Leo Heuser, 25-12-2004 Dim ColorRange As Range Dim Red As Integer, Green As Integer, Blue As Integer Set ColorRange = Selection Red = ColorRange.Interior.Color And &HFF Green = (ColorRange.Interior.Color And CLng(&HFF) * &H100) / &H100 Blue = (ColorRange.Interior.Color And CLng(&HFF) * &H10000) / &H10000 MsgBox "&H00" & _ String(2 - Len(Hex(Blue)), "0") & Hex(Blue) & _ String(2 - Len(Hex(Green)), "0") & Hex(Green) & _ String(2 - Len(Hex(Red)), "0") & Hex(Red) & _ "&" End Sub -- Best Regards Leo Heuser Followup to newsgroup only please. "Don Wiss" skrev i en meddelelse ... I'm finding that the palette of the controls on the Control toolbar is not the same as the background colors for workbook cells. How can I find the background color of a cell in the &H0080FFFF& format? Then I can, of course, simply enter that number in the control's property. Don <donwiss at panix.com. |
All times are GMT +1. The time now is 09:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com