Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Greetings,
I have three CommandButtons. I need to know which one was pushed last. Does anyone know what the syntax in VBA is to change the background color of CommandButton1 to pink and CommandButton2 to light gray? The help section was rather lacking on details for this question. Any help would be most appreciated. TIA -Minitman |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Minitman" wrote in message ... Greetings, I have three CommandButtons. I need to know which one was pushed last. Does anyone know what the syntax in VBA is to change the background color of CommandButton1 to pink and CommandButton2 to light gray? The help section was rather lacking on details for this question. Any help would be most appreciated. TIA -Minitman The following will set the colour of the button pressed to yellow and the other two to white. I'm sure that you will be able to do what you want with a little playing. Private Sub CommandButton1_Click() CommandButton1.BackColor = RGB(255, 255, 0) CommandButton2.BackColor = RGB(255, 255, 255) CommandButton3.BackColor = RGB(255, 255, 255) End Sub Private Sub CommandButton2_Click() CommandButton2.BackColor = RGB(255, 255, 0) CommandButton3.BackColor = RGB(255, 255, 255) CommandButton1.BackColor = RGB(255, 255, 255) End Sub Private Sub CommandButton3_Click() CommandButton3.BackColor = RGB(255, 255, 0) CommandButton2.BackColor = RGB(255, 255, 255) CommandButton1.BackColor = RGB(255, 255, 255) End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hey Peter,
Thank you, that is exactly what I was looking for. -Minitman On Tue, 05 Oct 2004 16:12:48 GMT, "Peter Andrews" wrote: "Minitman" wrote in message .. . Greetings, I have three CommandButtons. I need to know which one was pushed last. Does anyone know what the syntax in VBA is to change the background color of CommandButton1 to pink and CommandButton2 to light gray? The help section was rather lacking on details for this question. Any help would be most appreciated. TIA -Minitman The following will set the colour of the button pressed to yellow and the other two to white. I'm sure that you will be able to do what you want with a little playing. Private Sub CommandButton1_Click() CommandButton1.BackColor = RGB(255, 255, 0) CommandButton2.BackColor = RGB(255, 255, 255) CommandButton3.BackColor = RGB(255, 255, 255) End Sub Private Sub CommandButton2_Click() CommandButton2.BackColor = RGB(255, 255, 0) CommandButton3.BackColor = RGB(255, 255, 255) CommandButton1.BackColor = RGB(255, 255, 255) End Sub Private Sub CommandButton3_Click() CommandButton3.BackColor = RGB(255, 255, 0) CommandButton2.BackColor = RGB(255, 255, 255) CommandButton1.BackColor = RGB(255, 255, 255) End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Checkbox to change background color, font color and remove/ add bo | Excel Discussion (Misc queries) | |||
Conditional format color is set correct, yet color will not change | Excel Worksheet Functions | |||
How to change the default Border, Font Color, and Cell Color | Excel Discussion (Misc queries) | |||
CommandButton Caption change via macro | Excel Programming | |||
Change CommandButton Caption | Excel Programming |