Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Confirm a choice before Macro | Excel Discussion (Misc queries) | |||
How to confirm the open dialogue box by using macro coding? | Excel Worksheet Functions | |||
Confirm Autofilter off | Excel Programming | |||
Confirm deletion | Excel Programming | |||
Macro : confirm Delete | Excel Programming |