PDA

View Full Version : [SOLVED:] problem with changing colour



Phprahl
04-04-2005, 01:49 AM
Hello!

I wonder if it is possible to change the colour of a spreadsheet based click-button? I have tried, but with no luck.

Rgds
/Phprahl

Killian
04-04-2005, 04:04 AM
do you mean the color of the cells or the color pallette? The color pallette can only be changed for the entire workbook by changing the ActiveWorkBook.Colors values (referred to by index 1 to 56). To just change the cell colors use


Sub ChangeSheetColor()
With ActiveSheet
.Cells.Interior.ColorIndex = 4 'index of one of the 56 workbook colors
' use ColorIndex = xlNone to reset
End With
End Sub

Phprahl
04-04-2005, 05:07 AM
Killian,

Sorry I'm not expaining better....

I have made a button from the 'form' menue and have put it in a worksheet. Then I assigned a macro that runs when I click the button.

The Background colour of the button is classic windows-beige, but I want it to be black. I can not mark it and go to the 'fill' panel because it is not activated when the button is marked.

Is it possible to change the colour anyway?

Rgds
/Phprahl

It is sort of a commandbutton but I have not used Userform...

johnske
04-04-2005, 05:27 AM
Hi Phprahl,

Far as I know you can't change the colour of a 'forms' command button, but you can change a 'control' command button.

Another way around this is to use a text box as a command button and assign a macro to it. You can then play around with the textbox borders, colours, fills, etc. till it suits you. Have a look at the attachment for a couple of examples...

Regards,
John

Killian
04-04-2005, 06:22 AM
well maybe I should have read the question properly! :doh:
So I have no problems changing a command button on a spreadsheet. I just right-click it and select "Properties" and change the Forecolor(text) and backcolor values. (I have Office 2003)
Or am I missing another point?! (Monday... obviously another coffee required)