ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Command Button Active X controls (https://www.excelbanter.com/excel-discussion-misc-queries/160388-command-button-active-x-controls.html)

kenny

Command Button Active X controls
 
I have six command buttons that filter a sheet based on criteria. I have the
filter built. I want to see if someone can provide me with code to make the
command button look selected or filled grey when it is selected. Of course
when one is selected I need the others to be turned off. Can anyone help me.
Thanks!


FSt1

Command Button Active X controls
 
hi
you might try something like this...
Private Sub Commandbutton2_Click()
With Commandbutton2
.BackColor = RGB(0, 0, 255) ' blue
.Caption = "Selected"
.ForeColor = RGB(245, 245, 6) 'yellow
End With
Commandbutton3.Enabled = False
run your code here?
End Sub
see this site for RGB colors....
http://www.mvps.org/dmcritchie/excel/colors.htm
but a word of caution. if you are going to disable a control, you need a way
to enable it again. I would suggest that at the end of the code that the
selected button runs, you enable all of the buttons that you disabled and
change all the colors back.

Regards
FSt1
"Kenny" wrote:

I have six command buttons that filter a sheet based on criteria. I have the
filter built. I want to see if someone can provide me with code to make the
command button look selected or filled grey when it is selected. Of course
when one is selected I need the others to be turned off. Can anyone help me.
Thanks!



All times are GMT +1. The time now is 01:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com