Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Simple Yes / No messagebox followed by an if then else formula
Hi there
Created a macro that clears a spreadsheet, and have put in a button that runs it once clicked. Now all I want is a simple yes/no/cancel option to come up that, once the button is clicked, the user can still cancel before the macro runs, unless he is happy to go with it in which case all the data will be cleared. Pretty simple I'm sure, but I have no idea how to launch the messagebox, and then based on the yes / no click to run the macro or not?!? Any thoughts? Thanks, mike |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Simple Yes / No messagebox followed by an if then else formula
If MsgBox("Proceed?", vbYesNo, "Clear sheet") = vbYes Then
'Clear code End If -- Jim "mike_vr" wrote in message ... | Hi there | | Created a macro that clears a spreadsheet, and have put in a button that | runs it once clicked. Now all I want is a simple yes/no/cancel option to come | up that, once the button is clicked, the user can still cancel before the | macro runs, unless he is happy to go with it in which case all the data will | be cleared. | Pretty simple I'm sure, but I have no idea how to launch the messagebox, and | then based on the yes / no click to run the macro or not?!? | | Any thoughts? | | Thanks, | mike |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Simple Yes / No messagebox followed by an if then else formula
Here is an option that will give you the options 'ok' and 'cancel'. Take a
look at help for Msgbox if you need yes/no or yes/no/cancel. x = MsgBox("Do you want to run me", vbOKCancel, _ "Approval Option") If x = 2 Then Exit Sub Else ' your code to run goes here End If Steve Yandl "mike_vr" wrote in message ... Hi there Created a macro that clears a spreadsheet, and have put in a button that runs it once clicked. Now all I want is a simple yes/no/cancel option to come up that, once the button is clicked, the user can still cancel before the macro runs, unless he is happy to go with it in which case all the data will be cleared. Pretty simple I'm sure, but I have no idea how to launch the messagebox, and then based on the yes / no click to run the macro or not?!? Any thoughts? Thanks, mike |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF formula-simple question; simple operator | Excel Discussion (Misc queries) | |||
Simple problem, simple formula, no FUNCTION ! | Excel Worksheet Functions | |||
Help with MessageBox coding for newbie | Excel Worksheet Functions | |||
messagebox in excel 2003 | Excel Discussion (Misc queries) | |||
Printing messagebox | Excel Discussion (Misc queries) |