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 / December 2006

Tip: Looking for answers? Try searching our database.

One More Visual Basic Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lj - 20 Dec 2006 18:48 GMT
Hi, I'm creating a macro and wanted to know if there's a way (and what
the syntax would be) to have the macro look to see if a particular
worksheet exists and if it does delete it and if it doesn't exisit to
continue moving on in the macro.  Thanks for your help.
Bob Phillips - 20 Dec 2006 19:06 GMT
Dim sh As Worksheet

   On Error Resume Next
   Set sh = Worksheets("Sheet to be deleted"
   On Error Goto 0
   If Not sh Is Nothing Then
       Application.DisplayAlerts = False
       sh.delete
       Application.DisplayAlrerts = True
   End If

Signature

---
HTH

Bob

(change the xxxx to gmail if mailing direct)

> Hi, I'm creating a macro and wanted to know if there's a way (and what
> the syntax would be) to have the macro look to see if a particular
> worksheet exists and if it does delete it and if it doesn't exisit to
> continue moving on in the macro.  Thanks for your help.
lj - 20 Dec 2006 19:34 GMT
Thanks, this was exactly what i was looking for!

> Dim sh As Worksheet
>
[quoted text clipped - 19 lines]
> > worksheet exists and if it does delete it and if it doesn't exisit to
> > continue moving on in the macro.  Thanks for your help.
 
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.