ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I prevent unintentionally running a Macro? (https://www.excelbanter.com/excel-programming/372515-how-do-i-prevent-unintentionally-running-macro.html)

UA_Jeremy

How do I prevent unintentionally running a Macro?
 
So, I find myself accidentally running macros. I have about 20 setup on my
laptop. this usually occurs when I'm using the keyboard with 'ctrl'. Since,
you can't undo a macro this is a big problem for me.

So, I want to add some code to my macros that will make a messabe box pop-up
and ask me if I want to run the macro. If, I select 'yes' then the macro runs
as normal; if 'no', then the macro ends.

Can anyone help?

Die_Another_Day

How do I prevent unintentionally running a Macro?
 
If MsgBox("Macro1 Is about to launch. Continue?", vbYesNo) = vbNo Then
Exit Sub

Charles Chickering

UA_Jeremy wrote:
So, I find myself accidentally running macros. I have about 20 setup on my
laptop. this usually occurs when I'm using the keyboard with 'ctrl'. Since,
you can't undo a macro this is a big problem for me.

So, I want to add some code to my macros that will make a messabe box pop-up
and ask me if I want to run the macro. If, I select 'yes' then the macro runs
as normal; if 'no', then the macro ends.

Can anyone help?




All times are GMT +1. The time now is 11:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com