Solved

Simple excel vba question

Posted on 2013-05-17
2
435 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
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.

752 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