Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Audio warning when cells change | Excel Discussion (Misc queries) | |||
Deleting Sheets Warning | Excel Programming | |||
macro warning persists even after deleting all macros | Excel Discussion (Misc queries) | |||
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content | Excel Programming | |||
deleting sheet: how to omit warning | Excel Programming |