ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Toggle Event - 2 Commands on 1 Button (https://www.excelbanter.com/excel-programming/418311-toggle-event-2-commands-1-button.html)

Exceller

Toggle Event - 2 Commands on 1 Button
 
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.

Mike H.

Toggle Event - 2 Commands on 1 Button
 
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




All times are GMT +1. The time now is 11:24 AM.

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