HELP-HOW to Pause macro until user Keystoke

ectoid

Board Regular
Joined
Jan 18, 2005
Messages
97
I cannot figure out how to write a macro such that it will pause during its operation and then wait indefinately for a user to physically press a key before continuing.
Any suggestions?
Thank you so much...
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
Welcome to the Board!

You can stall code by adding a Message Box (i.E. MsgBox "Do you want to continue?")

As for the button press, you can use the SendKeys method to incorporate a keystroke into your code. You can trigger it dependent on the users MsgBox response. See the VBA helpfile for decent descriptions of both.

Hope that helps,

Smitty
 
Upvote 0

parry

MrExcel MVP
Joined
Aug 20, 2002
Messages
3,355
Hi, the simplest way requires no coding at all. When a macro is running you can press the ESC key and the macro will stop. When the User clicks the Continue button the macro will continue from where it stopped. If the End button is clicked the macro will finish at that point.
 
Upvote 0

ectoid

Board Regular
Joined
Jan 18, 2005
Messages
97
Sweet...thank you muchly...I was converging on the messagebox, but never found the MsgBox name to look up. I'm new! HA...Thanks a lot...
 
Upvote 0

Forum statistics

Threads
1,195,748
Messages
6,011,429
Members
441,614
Latest member
TiaGtz

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
Top