Pause macro or Keep from running until User Input

Johnboy267

New Member
Joined
Dec 20, 2008
Messages
17
I have a workbook with a couple of straightforward macros activated on buttons on a couple of different sheets.
Thanks to the penultimate knowledge on this board, I have been able to figure out how to store data and use this to create an "Undo" macro (sort of) that resets everything back to it's original condition. My question is:
If a user hits the "Reset" button, it will reset all their data back to the original. I want to want the usr with a popup message, and give hem the option of hitting "OK" or "Cancel". I can create a simple MsgBox popup, and I know how to create a UserForm, but I'm lost with:
A: Pausing the macro from running the rest of the script until after the user has hit OK. And/Or:
B: Having a User Form Popup to give the user the option of hitting Cancel to stop the macro from running without an error message, and just continuing with entering data into the spreadsheets normally.
Am I better off with a MsgBox or a UserForm, and how do I accomplish the OK or Cancel options and pause my script until input?
Thank you in advance for your help (Once again).
 

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.
Try

Code:
If MsgBox("Are you sure you want to do this?", vbOKCancel + vbQuestion) = vbCancel Then Exit Sub
 
Upvote 0
Worked perfectly!! This is why I love this board, it's like having an Ivy League College lab full of programming instructors at my disposal!

Thank you for the quick reply...
 
Upvote 0

Forum statistics

Threads
1,214,960
Messages
6,122,479
Members
449,088
Latest member
Melvetica

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