Solved

Simple excel vba question

Posted on 2013-05-17
2
440 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
[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 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
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 …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
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.

635 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