?
Solved

Delete Empty Worksheets

Posted on 2011-09-05
2
Medium Priority
?
259 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 500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

771 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