Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default msg box to clear a sheet

I need a msg box that has a yes and no button that ask if you want to clear
the sheet. If yes then continue to run the macro and if no then to stop at
that point. any help is appreciated. thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default msg box to clear a sheet

change the range to suit your needs

Sub Clear_Sheet()
Select Case MsgBox("Are you sure you want to clear all data?", _
vbYesNo Or vbQuestion Or vbDefaultButton1, Application.Name)

Case vbYes
ActiveSheet.Range("B3:O65,Q3:Q65").ClearContents

Case vbNo

End Select
End Sub

--


Gary


"Curt D." wrote in message
...
I need a msg box that has a yes and no button that ask if you want to clear
the sheet. If yes then continue to run the macro and if no then to stop
at
that point. any help is appreciated. thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default msg box to clear a sheet

Thanks that did it.

"Gary Keramidas" wrote:

change the range to suit your needs

Sub Clear_Sheet()
Select Case MsgBox("Are you sure you want to clear all data?", _
vbYesNo Or vbQuestion Or vbDefaultButton1, Application.Name)

Case vbYes
ActiveSheet.Range("B3:O65,Q3:Q65").ClearContents

Case vbNo

End Select
End Sub

--


Gary


"Curt D." wrote in message
...
I need a msg box that has a yes and no button that ask if you want to clear
the sheet. If yes then continue to run the macro and if no then to stop
at
that point. any help is appreciated. thanks




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
Copy Sheet to new Sheet and clear cells on original sheets Boiler-Todd Excel Discussion (Misc queries) 7 September 23rd 09 10:02 PM
Sheet Checkboxes clear Pete Excel Programming 2 September 11th 05 08:36 AM
How to Clear all Data on sheet after a given row Chirs Excel Programming 2 June 7th 05 02:30 AM
Clear all cell in a sheet Alvin Hansen[_2_] Excel Programming 2 November 22nd 04 01:13 PM
Code to clear sheet gregork Excel Programming 5 February 7th 04 06:34 PM


All times are GMT +1. The time now is 08:02 AM.

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

About Us

"It's about Microsoft Excel"