VBA - stopping a macro from running via keypress

zsemle

New Member
Joined
Mar 9, 2022
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
Hello everyone!
I have a userform which takes around 1,5 hrs to run. I press a button and then the timer starts. (It handles thousands of columns and rows, I am working on optimizing it, but still something like this would be user friendly) I want to be able to stop it at any given time by pressing a button eg.: escape or enter etc.
I have never tried anything like this before, and after searching a lot didn't find any similar questions to mine.
Is there any way something like this can be made?
Pressing escape or ctrl+pause/break doesn't work at all, because the program is already so slow.
A solution is of course ctrl+alt+del, but it is not very subtle.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Stopping it would be an option too, just halting the run time and then the user would be able to close the program.
 
Upvote 0

Forum statistics

Threads
1,223,702
Messages
6,173,961
Members
452,539
Latest member
delvey

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