Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Need Warning Box before deleting cells

Hey
Thanks to all for the HELP I'm getting from this group!
I have a macro set to clear all the cells in a work schedule
spreadsheet and a button to run the macro.
When I push the button I need a WARNING BOX to appear
to ask something like "Are you sure you want to clear the spreadsheet?"
So as to not accidently clear the worksheet.
How do I do this. Additional code written into the macro?
thanks
Raymond
--
dzierzekr
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Need Warning Box before deleting cells

Sub YourSub()
If MsgBox("Are you sure you want to clear the spreadsheet?", vbYesNo +
vbCritical) = vbNo Then Exit Sub
'YourCode
End Sub

HTH

Charles Chickering

dzierzekr wrote:
Hey
Thanks to all for the HELP I'm getting from this group!
I have a macro set to clear all the cells in a work schedule
spreadsheet and a button to run the macro.
When I push the button I need a WARNING BOX to appear
to ask something like "Are you sure you want to clear the spreadsheet?"
So as to not accidently clear the worksheet.
How do I do this. Additional code written into the macro?
thanks
Raymond
--
dzierzekr


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Need Warning Box before deleting cells

As a matter of style, I would use vbQuestion (or possibly
vbExclamation) rather than vbCritical

You can also try to avoid accidents by making
the No button the default:

If MsgBox("Are you sure you want to clear the spreadsheet?", _
vbQuestion + vbYesNo + vbDefaultButton2) = vbNo Then Exit Sub


Die_Another_Day wrote:
Sub YourSub()
If MsgBox("Are you sure you want to clear the spreadsheet?", vbYesNo +
vbCritical) = vbNo Then Exit Sub
'YourCode
End Sub

HTH

Charles Chickering

dzierzekr wrote:
Hey
Thanks to all for the HELP I'm getting from this group!
I have a macro set to clear all the cells in a work schedule
spreadsheet and a button to run the macro.
When I push the button I need a WARNING BOX to appear
to ask something like "Are you sure you want to clear the spreadsheet?"
So as to not accidently clear the worksheet.
How do I do this. Additional code written into the macro?
thanks
Raymond
--
dzierzekr


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
Audio warning when cells change Ruben Excel Discussion (Misc queries) 1 August 17th 07 08:30 PM
Deleting Sheets Warning narutard[_28_] Excel Programming 2 September 14th 05 04:22 PM
macro warning persists even after deleting all macros Todd Excel Discussion (Misc queries) 3 July 25th 05 10:12 PM
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content rmaloy Excel Programming 5 February 9th 04 01:59 AM
deleting sheet: how to omit warning Marco Braun Excel Programming 4 December 9th 03 03:54 PM


All times are GMT +1. The time now is 04:11 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"