Create a Warning Prompt before running a Macro..?

Eggspit

New Member
Joined
Oct 23, 2006
Messages
39
I have a macro that is activated by pressing a button, Is it possible to add a line of code, so when the user clicks on the button, they are prompted with a warning message that’s give them the opportunity to proceed..?

Example :

Button pressed by user
Warning message “Do you want to proceed .?”
User presses Yes and the Macro runs as normal

(User presses No and Macro doesn’t run)

Thanks Loads,
Egg
 

Some videos you may like

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Tyler_Dirton

Board Regular
Joined
Oct 24, 2006
Messages
50
Hi,

This can be done in a couple of simple lines of code:

Dim reply
reply = MsgBox("Do you want to proceed.?", vbYesNo)
If reply = vbNo Then Exit Sub
'
rest of your code here
'
End Sub

Hope this helps

DR
 

Watch MrExcel Video

Forum statistics

Threads
1,111,910
Messages
5,541,538
Members
410,547
Latest member
htran4
Top