Command button not working after becoming visible

Drofidnas

Board Regular
Joined
Jun 30, 2004
Messages
125
Hi

I'm developing a game in Excel.

I have two hidden buttons for "yes" or "no" answers which become visible when a shape is clicked.

However, when they do become .visible=msotrue they don't work.
Yet if I click another command button that has always been visible, they both become active again.

It's like they need a programmatic kick to start after being shown - am I missing somerhing?

Thanks in advance.

Chris
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,761
Office Version
2013
Platform
Windows
Assuming your using Activex Command buttons.

When I put these two scripts in a shape they work for me.
And the button performs like planned when clicked on after being made visible.

Code:
Sub Hide_Me()
'Modified  11/10/2018  11:27:19 PM  EST
ActiveSheet.CommandButton1.Visible = False
End Sub
Sub Unhide_Me()
'Modified  11/10/2018  11:27:19 PM  EST
ActiveSheet.CommandButton1.Visible = True
End Sub
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,761
Office Version
2013
Platform
Windows
If you want to Toggle the Command Button Visible Not Visible
Using only one script:
Try this:

Code:
Sub Toggle_Me()
'Modified  11/10/2018  11:35:19 PM  EST
ActiveSheet.CommandButton1.Visible = Not ActiveSheet.CommandButton1.Visible
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,099,043
Messages
5,466,198
Members
406,472
Latest member
QuarkJaguar

This Week's Hot Topics

Top