Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How Do you Change The Color Of The CommandButton That You Just Prshed

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How Do you Change The Color Of The CommandButton That You Just Prshed


"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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How Do you Change The Color Of The CommandButton That You Just Prshed

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox to change background color, font color and remove/ add bo Sara Excel Discussion (Misc queries) 2 May 1st 23 11:43 AM
Conditional format color is set correct, yet color will not change Mark Excel Worksheet Functions 12 February 5th 09 12:08 AM
How to change the default Border, Font Color, and Cell Color Elijah Excel Discussion (Misc queries) 3 November 2nd 05 11:52 PM
CommandButton Caption change via macro PCLIVE Excel Programming 3 September 20th 04 08:29 PM
Change CommandButton Caption Claude Excel Programming 4 July 16th 04 04:18 PM


All times are GMT +1. The time now is 04:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"