Toggle Event - 2 Commands on 1 Button

E

Exceller

I'm looking for just the basic code that will allow 2 macros to execute
independently of each other when the button they're assigned to is actuated,
or toggled (for example...I use Essbase and I need to toggle it on and off
frequently, as it disallows me to format sheets while it's on). I'll be
using this for a variety of different "toggle" actions and just need the
basic code that accomplishes this, to sandwich the macros between. Thanks.
 
M

Mike H.

I think this is what you wish to do (This is the code behind a button):

Private Sub CommandButton2_Click()
If CommandButton2.Caption = "Second Step" Then
CommandButton2.Caption = "First Step"
Call SecondStep
ElseIf CommandButton2.Caption = "First Step" Then
CommandButton2.Caption = "Second Step"
Call FirstStep
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top