View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ExcelMonkey ExcelMonkey is offline
external usenet poster
 
Posts: 553
Default John Walkenbach Color Palette (Repost)

This is a repost. I posted this yesterday but did not describe it properly.

I am using the JW color palette. I am using it to do the following:

1) Pass a color from palette to the backcolor property of a button on a
userform
2) test to see if font color in specific cell matches backcolor property of
button

Firstly, when I call up the palette, most colors pass correctly to the
button on the userform. However the top left color (Black) will not pass to
the form. When I drag the cursor over the color black, the JW form tells me
that its RGB color is:

0 0 0

Why will this not turn the button black?

Secondly, in situations where the color passes correctly to the button, the
test to see if font color = button back color fails. For example, when I
pass red to the button (RGB(255,0,0)), the button turns red. However my test
for red font does not seem to work. The procedure is:

Public Function CellFontHasColour(rng As Range)
If rng.Font.Color = FontColorColBtn.BackColor Then
CellFontHasColour = True
End If
End Function

Yet in my immediate window I get:
?rng.Font.Color
255

?FontColorColBtn.BackColor
12632256

My font is clearly red as illustratd by the 255. Yet my BackColor property
of the button which I clearly passed red to now says 12632256.

I must admit I am really struggling with the whole colour issue in VBA.

Thanks