Changing color in palette

G

Gilbert De Ceulaer

I have several workbooks all linked together.
Some of them are old, some of them are newer (Maybe, I even started them in
a different version of Excel)
When I choose a background color for a cell the color that shows in a
certain position on the palette is not the same in all the workbooks. I
checked it with a macro :

Sub Kleurtest()
'
' Kleurtest Macro
' Macro recorded 12/12/2004 by GDC
'
' Keyboard Shortcut: Ctrl+Shift+D
'
With Selection.Interior
.ColorIndex = 38
.Pattern = xlSolid
End With
End Sub

In one workbook it give me a reddish pink, an another this gives me an
darker pink.

Is the any way of changing the one of the colors in the palette, so I can
have the same color attached to this ".colorindex = 38" ?

Gilbert De Ceulaer
(e-mail address removed)
 
B

Bob Phillips

Gilbert,

This changes it to the pink I have on my system

ActiveWorkbook.Colors(38) = 13408767


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
G

Gilbert De Ceulaer

Thanks !
13408767 is the "reddish" pink
but with your information, I was able to look up the value for the darker
pink, that is 13409484, and I managed to change it !
BTW, where do you get the values, and how do you make new ones ?
Gilbert
 
B

Bob Phillips

Gilbert,

I got that value by setting a cell to the colour, and then doing
?Activecell.Color in the immediate window.

You can also set it to RGB colours like

ActiveWorkbook.Colors(38) = RGB(255,128,128) or
ActiveWorkbook.Colors(38) = RGB(&HFF,&H80,&H80)

which may be easier to work with. These RGB colours should be available from
many sources on the web, or you can paly with the colour palette in Excel to
get them. Goto Tools>Options>Colour, click Modify ad on the Custom tab you
can play with the colours and see their red, green, blue values.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
P

Peter T

Hi Gilbert,

You have enough good replies but a bit more background:
If you are working with old (xl95) & new workbooks you've probably noticed
the default palettes are different. 19 differences, one of these is
colorindex 38 which is 13409484 and 13408767 respectively. Or
RGB(204,156,204) and RGB(255,153,204).

If it's acceptable for your old workbooks to adopt the new palette, you
could reset the palette of each with the new "default" colours. This will
change the appearance of some colours in your old wb's but at least from now
on copy/paste between wb's will result in consistent colours.

You can do this manually, Tools > Options > Colors or a simple macro to
reset all open wb's

Sub UpdatePalettes()
Dim wb As Workbook
For Each wb In Application.Workbooks
wb.ResetColors
Next
End Sub

However, occasionally it can be impossible to reset an old palette to that
of the new.



Regards,
Peter
 
P

Peter T

I said
However, occasionally it can be impossible to reset an old palette to that
of the new.
and should have added, that whilst this is unlikely there is also just a
remote possibility whilst resetting an old palette with the macro that Excel
could crash. So ensure everything is saved before running.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top