Solved

Excel Delete Worksheet and cretae new work sheet

Posted on 2014-09-04
3
178 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

749 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