Solved

Excel Delete Worksheet and cretae new work sheet

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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
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 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 using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

825 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