need to set a cell background color which is not within the Excel colorindex range

O

Oscar

Is there a way to set the background color of a cell in another way than the
interior.colorindex property ? I need to set a very light red color, and the
reds that Exel exposes within the colorindex range are too dark for this.
I've tried to change the background color outside from a VB app with
interior.color=....colornr but that results in Excel in other colors than VB
normally does when using the same color numbers.

Oscar
 
B

Bob Phillips

Oscar,

You could use Color=RGB(... but Excel will map that onto the equivalent
ColorIndex anyway. What you can do instead is to change the colour in the
colour palette. Goto menu Tools>Options and select the Color tab, select
the red colour, click the Modify button, select the Custom tab, and select
the shade of red you want. OK it and the Red ColorIndex takes on that
colour.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
O

Oscar

Thanks Bob,
I've seen that it worked. Let's see whether the whole subject can be
automated by VB/VBA.

Oscar
 
B

Bob Phillips

ActiveWorkbook.Colors(3) = RGB(242, 20, 20)

If you know the RGB values (I have to do it by trial and error), you are
away<vbg>

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
O

Oscar

thank you Bob and Gord,

I've found the right RGB-value and successfully added it by coding.

Oscar
 
Top