Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Passing Back Color to Interior Color

I have a routine that passes the back colour of a button
to the interior colour of a range called Comrng. The
colour the button takes on is based on a routine. When
the button is coloured(by routine), the routine works
fine. However, when I have it set up using its default
grey (&H8000000F&) colour, teh Comrng takes the valu of 0
and diplays a black interior color.

When it is woking, the immediate window shows:
?CellComColBtn.BackColor
16764057
?Comrng.Offset(-1, 0).Interior.Color
16764057
When its not it shows:
?CellComColBtn.BackColor
-2147483633
?Comrng.Offset(-1, 0).Interior.Color
0

What is going on here?????

If ComChkBx = True Then
Set Comrng = .Worksheets(AuditShtName).Range
(PasteStartCell).Offset(0, ChkbxArray(0, 1) * 2 - 2)
Comrng.Offset(-1, 0) = "Cell Comments"
Comrng.Offset(-1, 0).Interior.Color =
CellComColBtn.BackColor
End If
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Passing Back Color to Interior Color

That's because your working with apples and oranges.

The default gray color of the button is only gray because those are your
windows settings. the number (&H8000000F&) is not an RGB color - it is a
code designating the button should take on the system color defined for
Button Face. If you go to the desktop, select properties and assign a
different color for button face, then show your form, it should take on this
new color, but still have the value (&H8000000F&) . You can set a button
to a specific color using RGB. Then it would return the RGB in that case
(the 16764057 in your example)

the cells are using RGB colors, so when you feed this value to it, it
converts it to an RGB color.

the max RGB color is:
? &HFFFFFF
16777215
your color number is bigger than that, so you can use an if test to
determine that the value is or isn't and RGB color value and adjust from
there.

You can see this by going into the properties window of the button and
looking at the backcolor property. the initial choices are system colors
(on the system tab). You can select the palette tab and assign an RGB
color.

--
Regards,
Tom Ogilvy


"ExcelMonkey" wrote in message
...
I have a routine that passes the back colour of a button
to the interior colour of a range called Comrng. The
colour the button takes on is based on a routine. When
the button is coloured(by routine), the routine works
fine. However, when I have it set up using its default
grey (&H8000000F&) colour, teh Comrng takes the valu of 0
and diplays a black interior color.

When it is woking, the immediate window shows:
?CellComColBtn.BackColor
16764057
?Comrng.Offset(-1, 0).Interior.Color
16764057
When its not it shows:
?CellComColBtn.BackColor
-2147483633
?Comrng.Offset(-1, 0).Interior.Color
0

What is going on here?????

If ComChkBx = True Then
Set Comrng = .Worksheets(AuditShtName).Range
(PasteStartCell).Offset(0, ChkbxArray(0, 1) * 2 - 2)
Comrng.Offset(-1, 0) = "Cell Comments"
Comrng.Offset(-1, 0).Interior.Color =
CellComColBtn.BackColor
End If



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
No Interior Color Macro simplymidori[_2_] Excel Discussion (Misc queries) 1 April 11th 08 05:01 AM
Cell interior color JohnB Excel Discussion (Misc queries) 4 October 12th 06 06:07 PM
color the interior of a range Pierre via OfficeKB.com Excel Worksheet Functions 1 November 2nd 05 12:55 PM
Interior Cell color Pellechi Excel Programming 1 September 23rd 03 03:39 PM


All times are GMT +1. The time now is 09:56 AM.

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

About Us

"It's about Microsoft Excel"