Solved

Delete Empty Worksheets

Posted on 2011-09-05
2
257 Views
Last Modified: 2012-05-12

Need to delete all worksheets in workbook that have no data.
0
Comment
Question by:mato01
[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 11

Expert Comment

by:Plantwiz
ID: 36484753
Highlight the worsheet tab, right click, delete

Or is there more information you are able to provide regarding your initial question?
0
 
LVL 81

Accepted Solution

by:
byundt earned 125 total points
ID: 36484890
Here is a macro to delete the empty worksheets. Install it in a regular module sheet.
Sub DeleteEmptySheets()
Dim ws As Worksheet
Dim rg As Range
On Error Resume Next
Application.DisplayAlerts = False
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
    Set rg = ws.UsedRange
    If (rg.Cells.Count = 1) And (rg.Cells(1, 1) = "") Then ws.Delete
Next
Application.DisplayAlerts = True
End Sub

Open in new window


Brad
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

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.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

690 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