Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default 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!
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default 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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to count cells with specific format (background color)? Blackheartedowl Excel Discussion (Misc queries) 1 February 8th 06 08:21 AM
Format Background Color Teaser nastech Excel Discussion (Misc queries) 0 November 1st 05 08:51 PM
Default Border, Font Color, and Cell Background Color Elijah Excel Discussion (Misc queries) 1 October 28th 05 04:10 PM
Sensing actual format background color Ron Excel Programming 3 May 1st 04 12:55 PM
Determining active conditional format of one cell Antonio[_3_] Excel Programming 1 November 27th 03 12:38 AM


All times are GMT +1. The time now is 01:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"