Solved

Excel Delete Worksheet and cretae new work sheet

Posted on 2014-09-04
3
165 Views
Last Modified: 2014-09-08
Hello Experts Exchange
I need a bit of VB code that will do the following.

Check if there is a worksheet called Import.
If there is a worksheet called import delete it from the excel file.

Regards

SQLSearcher
0
Comment
Question by:SQLSearcher
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 500 total points
Comment Utility
Hi,

This code will address your requirements...

Public Sub Q_28511584()
 
  Application.DisplayAlerts = False
  
  On Error Resume Next
  
  Worksheets("Import").Delete
  
  On Error GoTo 0
  
  Application.DisplayAlerts = True
  
End Sub

Open in new window


However, what should happen if the only worksheet within the workbook is called [Import]?
0
 

Author Closing Comment

by:SQLSearcher
Comment Utility
Thank you very much for your help.
0
 
LVL 35

Expert Comment

by:[ fanpages ]
Comment Utility
You are very welcome.

Good luck with your project.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now