Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Simple excel vba question

Posted on 2013-05-17
2
Medium Priority
?
448 Views
Last Modified: 2013-05-19
Hello,
Within a workbook I have a number of sheets, which could be named from 1-??? - ??? denoting infinity.
I need a simple macro to loop through the workbooks, if the sheet name is between 1 & ??? then delete it.
TIA.
0
Comment
Question by:Ot_Gu
2 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 2000 total points
ID: 39175314
Assuming your workbooks are open already:

sub deleteNumericSheets
dim wbk as workbook, sht as worksheet

application.displayalerts=false

for each wbk in activewindow.workbooks
for each sht in wbk.worksheets
if isnumeric(sht.name) then sht.delete
next sht

next wbk

application.displayalerts=true

end sub
0
 

Author Closing Comment

by:Ot_Gu
ID: 39180180
Sorry for delay in replying - that is what i was looking for.
Pls accept these points with my thanks :)
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

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 …
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

824 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