Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to cancel a macro once started?
I know nothing about VBA except the recorder and able to modify a bit.
I have a macro to erase a form that is activated with a button. I would like to be able to have a message to confirm the deletion (Msgbox ) but have the choice to say no and stop the macro from erasing. I would appreciate any help please Thanking you in advance John |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to cancel a macro once started?
Try :
answ = MsgBox("Are you really sure ?", vbYesNo) If answ = vbNo Then Exit Sub ' delete Regards. Daniel I know nothing about VBA except the recorder and able to modify a bit. I have a macro to erase a form that is activated with a button. I would like to be able to have a message to confirm the deletion (Msgbox ) but have the choice to say no and stop the macro from erasing. I would appreciate any help please Thanking you in advance John |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to cancel a macro once started?
Thank you Daniel
It works great Have a nice day John "Daniel.C" wrote in message ... Try : answ = MsgBox("Are you really sure ?", vbYesNo) If answ = vbNo Then Exit Sub ' delete Regards. Daniel I know nothing about VBA except the recorder and able to modify a bit. I have a macro to erase a form that is activated with a button. I would like to be able to have a message to confirm the deletion (Msgbox ) but have the choice to say no and stop the macro from erasing. I would appreciate any help please Thanking you in advance John |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to cancel a macro once started?
A one liner:
If MsgBox("Do you want to delete?", vbYesNo + vbQuestion, "Confirm Delete") = vbNo Then Exit Sub CE John wrote: I know nothing about VBA except the recorder and able to modify a bit. I have a macro to erase a form that is activated with a button. I would like to be able to have a message to confirm the deletion (Msgbox ) but have the choice to say no and stop the macro from erasing. I would appreciate any help please Thanking you in advance John |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to cancel a macro once started?
Thanks Charlotte
Works great Regards John "Charlotte E." <@ wrote in message ... A one liner: If MsgBox("Do you want to delete?", vbYesNo + vbQuestion, "Confirm Delete") = vbNo Then Exit Sub CE John wrote: I know nothing about VBA except the recorder and able to modify a bit. I have a macro to erase a form that is activated with a button. I would like to be able to have a message to confirm the deletion (Msgbox ) but have the choice to say no and stop the macro from erasing. I would appreciate any help please Thanking you in advance John |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to cancel a macro once started?
Daniel;
Thanks very much for the code. It is working wonderfully!!!!!! Kind regards. Maperalia "Daniel.C" wrote: Try : answ = MsgBox("Are you really sure ?", vbYesNo) If answ = vbNo Then Exit Sub ' delete Regards. Daniel I know nothing about VBA except the recorder and able to modify a bit. I have a macro to erase a form that is activated with a button. I would like to be able to have a message to confirm the deletion (Msgbox ) but have the choice to say no and stop the macro from erasing. I would appreciate any help please Thanking you in advance John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to get Started with macro? | Excel Discussion (Misc queries) | |||
How to return to worksheet where macro started? | Excel Programming | |||
cancel the "Getting Started" Dialogue Box when I open XL/Word | Setting up and Configuration of Excel | |||
Cancel button to cancel the whole macro | Excel Programming | |||
Cancel Macro is user selects 'cancel' at save menu | Excel Programming |