Excuse my ignorance, but how can I make a command button self destruct?
I'm making an excel 'zerg rush' style game thingy.
Thanks
Excuse my ignorance, but how can I make a command button self destruct?
I'm making an excel 'zerg rush' style game thingy.
Thanks
Like this?
Private Sub CommandButton1_Click() MsgBox "About to self destruct" Me.Shapes("CommandButton1").Delete End Sub
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Perfect! Thanks!
This is probably quite an unusual question, but how could I make a command button self destruct if another command button lands on it? I cannot record this as I do not know which command button will land on what command button...
Thanks
Buttons don't land.
What are you trying to do.
Please be aware that removing or adding an ActiveX control on a worksheet resets the code in the file in question.
Rather than destroying controls, it is probably better to make them not visible.
Ok. I was trying to make a 'zerg rush' game where little squares (command buttons) jump round and when one lands on your square your square 'dies'.