Solved

Excel Delete Worksheet and cretae new work sheet

Posted on 2014-09-04
3
186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 500 total points
ID: 40303660
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
ID: 40305358
Thank you very much for your help.
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 40309281
You are very welcome.

Good luck with your project.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

726 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