Display warning before running macro

  • Thread starter Thread starter Jamie
  • Start date Start date
J

Jamie

Is it possible to display a warning message before running
a macro with a command button?
 
Hi,

Include this line of code at the top of the macro:

If Msgbox("Are you sure?",vbQuestion+vbYesNo,"Look out!!")
=vbNo Then Exit Sub

Regards,

Jan Karel Pieterse
Excel TA/MVP
 
Jamie,

Sure. Just put this code at the top of your macro.

If MsgBox("Are you SURE you want to run this macro?", _
vbYesNo) = vbNo Then Exit Sub

HTH,
Bernie
 
Back
Top