A warning message on a macro

zilch4ry

Board Regular
Joined
Feb 27, 2011
Messages
76
Hi, I was just wondering if anybody knows if it is possible to place a warning message onto a macro before the macro runs, for example a warning such as "Have you made sure all information entered is correct?" then if the user selects 'Yes', the macro will run. any help on this will be greatly appreciated.

Thanks,





Tom
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
You can create additional userform which with two button yes/no then u can run the macro with yes or no back to normal.
 
Upvote 0
Try something like this:
Code:
[COLOR=darkblue]Sub[/COLOR] test()
   [COLOR=darkblue]Dim[/COLOR] answer [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR]
 
   answer = MsgBox("OK to Proceed?", vbYesNo)
 
   [COLOR=darkblue]If[/COLOR] answer = vbNo [COLOR=darkblue]Then[/COLOR]
     Exit [COLOR=darkblue]Sub[/COLOR]
   [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
 
[COLOR=green]  '[/COLOR]
[COLOR=green]  'code for answer = Yes goes here[/COLOR]
[COLOR=green]  '[/COLOR]
 
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Sub[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,289
Members
452,902
Latest member
Knuddeluff

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