Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / April 2008

Tip: Looking for answers? Try searching our database.

Message Box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
alish - 12 Apr 2008 17:22 GMT
All, below is the code that I use to delete contents of the open sheet. How
do I make it ask or show a message box with 'Yes' or 'No' asking to delet or
not? Thanks in advance.

   Cells.Select
   Selection.Delete Shift:=xlUp
 
End Sub
Dave Peterson - 12 Apr 2008 17:36 GMT
Dim resp as long
resp = msgbox(Prompt:="Are you sure", buttons:=vbyesno)
if resp = vbno then
 'do nothing
else
 activesheet.rows.delete
end if

> All, below is the code that I use to delete contents of the open sheet. How
> do I make it ask or show a message box with 'Yes' or 'No' asking to delet or
[quoted text clipped - 4 lines]
>
> End Sub

Signature

Dave Peterson

alish - 12 Apr 2008 18:36 GMT
Thanks, Dave, it worked!

> Dim resp as long
> resp = msgbox(Prompt:="Are you sure", buttons:=vbyesno)
[quoted text clipped - 12 lines]
> >
> > End Sub
Shane Devenshire - 12 Apr 2008 20:24 GMT
Hi,

Note also that you can simplify the code to

Cells.Clear

Cheers,
Shane Devenshire
Microsoft Excel MVP

You are automatically prompted

> All, below is the code that I use to delete contents of the open sheet.
> How
[quoted text clipped - 6 lines]
>
> End Sub

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.