defrag an excel file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an Excel 2003 workbook in which I created a lot of pivot tables, all
of which I have deleted. There must be some data hidden because the file has
grown to 2.5MB and is very slow to navigate. How can I delete the hidden
tables?
 
It is probably better to copy the worksheets to a new wrokbook. sometimes a
workbook gets corrupted and the only solution is to move the sheets to a new
workbook.

the macro below will automatically create a new workbook and move the
worksheets. charts will not be moved and if there are references between
worksheets they probably won't get updated. You may need to update links by
going to worksheet menu Edit - Links to get the links updated.


Sub movetonew()

Workbooks.Add
Set NewWbk = ActiveWorkbook
For Each wbk In ThisWorkbook.Worksheets
wbk.Copy after:=NewWbk.Sheets(NewWbk.Worksheets.Count)
Next wbk
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top