Home » excel » How to Delete Multiple Blank "Microsoft Excel Objects"

How to Delete Multiple Blank "Microsoft Excel Objects"

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have a spreadsheet with one sheet named “Sheet1”. I have unhidden all other sheets and removed them. When I open the VBA editor, under “Microsoft Excel Objects” I have nearly 4000 Sheets listed, and I cannot remove them via right click.

It is my belief that this is causing the file’s size to be way too large (~6 MB) when there is no data held in “Sheet1”. I have tried using the “goto>special>objects” method, and no objects are found this way.

Any ideas on how to clear out all these empty objects?

VBA Explorer

How to&Answers:

I think I found a solution, at least it’s working for me and I’m not very savvy with VBA. Add the Properties Window (under view), select each sheet, and change the Visible option to -1 – xlsheetvisible, it will make it appear in the excel and then you can delete the tab.

Answer:

There are many ways to achieve what you want. The fastest way is right click on Sheet1 and click on “Move or Copy” ~~> “New Book” ~~> “OK”

Now you can save the new workbook and delete the old one 🙂

FOLLOWUP

Unfortunately this won’t work – we have some pretty lengthy formulas in other sheets with this exact problem and Excel will only copy the first 255 characters of them. Additionally, the VBA code in the original sheet is not copied, involving additional steps to rebuild each spreadsheet affected with this problem.

In such a case try this code

Option Explicit

Sub Sample()
    Dim ws As Worksheet

    Application.ScreenUpdating = False
    Application.DisplayAlerts = False

    For Each ws In ThisWorkbook.Sheets
        If ws.Name <> "Sheet1" Then ws.Delete
    Next

    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
End Sub

enter image description here