![]() |
Macro confirm to run
I have created a simpel macro that deletes data in mutiple ranges,
I have assigned this macor to a button on the sheet. I would like to have a confirmation window or checkbox pop up befor tha delete code runs so the user has a way to stop it if was pressed by mistake. Is this possabel Thanks for any Help |
Macro confirm to run
use a statement like:
If msgbox("delete data?",vbokcancel) = vbcancel then exit sub If Ok is selected, then the macro continues to run. Bob Flanagan Macro Systems 144 Dewberry Drive Hockessin, Delaware, U.S. 19707 Phone: 302-234-9857 http://www.add-ins.com Productivity add-ins and downloadable books on VB macros for Excel "Neil R" wrote in message ... I have created a simpel macro that deletes data in mutiple ranges, I have assigned this macor to a button on the sheet. I would like to have a confirmation window or checkbox pop up befor tha delete code runs so the user has a way to stop it if was pressed by mistake. Is this possabel Thanks for any Help |
Macro confirm to run
This is a fancier version of the above:
Response = MsgBox(Prompt:="This will delete the data in YOUR ROWS" & Chr(13) & "Do you want to continue?", Buttons:=vbYesNo + vbDefaultButton2, Title:="DELETE DATA?") If Response = vbYes Then YOUR MACRO Else SOME OTHER ACTION ' Exit Sub, Range("A1").select End If End Sub You can customize the message (Prompt:="make changes here") as needed. The Title can be changed between the "as well". + vbDefaultButton2 ' sets the default to NO ({Button1 defaults to YES). The enter key or mouse clicks the default button. Health and Happiness, Lou "Bob Flanagan" wrote: use a statement like: If msgbox("delete data?",vbokcancel) = vbcancel then exit sub If Ok is selected, then the macro continues to run. Bob Flanagan Macro Systems 144 Dewberry Drive Hockessin, Delaware, U.S. 19707 Phone: 302-234-9857 http://www.add-ins.com Productivity add-ins and downloadable books on VB macros for Excel "Neil R" wrote in message ... I have created a simpel macro that deletes data in mutiple ranges, I have assigned this macor to a button on the sheet. I would like to have a confirmation window or checkbox pop up befor tha delete code runs so the user has a way to stop it if was pressed by mistake. Is this possabel Thanks for any Help |
All times are GMT +1. The time now is 08:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com