Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Confirm a choice before Macro JSnow Excel Discussion (Misc queries) 3 October 9th 08 08:00 PM
How to confirm the open dialogue box by using macro coding? Eric Excel Worksheet Functions 3 June 13th 07 12:54 PM
Confirm Autofilter off Chris Excel Programming 2 January 13th 05 07:13 PM
Confirm deletion dsan Excel Programming 1 April 19th 04 02:48 PM
Macro : confirm Delete Tom Excel Programming 2 April 6th 04 09:50 AM


All times are GMT +1. The time now is 01:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"