Toggle Button to Start and Stop Macros

kwooden

New Member
Joined
May 5, 2021
Messages
11
Office Version
  1. 365
Platform
  1. Windows
I have a user form with a toggle button which calls two different macros when the button is pressed. I'm trying to stop running both macros when the button is depressed but not sure of the correct command. I've been searching all over the internet without any luck. I'm sure it's something very simple Below is the code I currently have.

Private Sub ToggleButton1_Click()
If ToggleButton1 = True Then
ToggleButton1.Caption = "Start"
Call Calculate_Range
Call DisplayTime
Else
ToggleButton1.Caption = "Stop"
End If
End Sub
 
I don't really understand your problem, isn't this what you were asking for
which give me the months, days, hours, minutes, and seconds from current date to 12 Sep 23
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
I keep getting this error when I try to run the code
1687059639463.png
 
Upvote 0
That means exactly what it says, you have got two lines in your code which declare ntime. You need to delete one of them
 
Upvote 0

Forum statistics

Threads
1,215,713
Messages
6,126,412
Members
449,314
Latest member
MrSabo83

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top