Reduce Excel file size

JoeS01

Well-known Member
Joined
Jun 25, 2005
Messages
829
I have a file with lots of data. Each time I add a new chart, or pivot table, it balloons out, well beyond what is expected. It is now 350MB in size. Is there any way I can reduce this size?

I would welcome all suggestions
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

DominicB

Well-known Member
Joined
Oct 3, 2005
Messages
1,569
Good morning JoeS01

Are your some (or all) pivot tables based on the same range? If so, you can use (say) PT1 to summarise the range A1:M1000, and rather than base PT2 on the same range (which is memory inefficient) you can base it on PT1 - that's if you want to work on the same range. Excel will give you this option when you set up PT2.

Alternatively, do any of the points in this thread help?

http://www.mrexcel.com/board2/viewtopic.php?t=232835

HTH

DominicB
 

JoeS01

Well-known Member
Joined
Jun 25, 2005
Messages
829
Thanks for your helpful reponse, Dom.

I tried saving the file as a .html web page, then restoring it as a .xls workbook, but the file size of the restored size was the same as the original
 

mrhartley

Well-known Member
Joined
Mar 8, 2005
Messages
564
If it helps, yo might need to remove some formula, if you have it.
Copy / Paste Special Values.

This can help me sometimes.

Also the following code might help, it agains has helped on a rare occasion. Be sure to make a backup first.

Rich (BB code):
Sub WorkbookReducer()
    'From: http://www.contextures.com/xlfaqApp.html#Unused
    ' Re-set used range
    
    Dim myLastRow As Long
    Dim myLastCol As Long
    Dim wks As Worksheet
    Dim dummyRng As Range
        
        For Each wks In ActiveWorkbook.Worksheets
            With wks
                myLastRow = 0
                myLastCol = 0
                Set dummyRng = .UsedRange
                On Error Resume Next
                myLastRow = _
                    .Cells.Find("*", after:=.Cells(1), _
                    LookIn:=xlFormulas, lookat:=xlWhole, _
                    searchdirection:=xlPrevious, _
                    searchorder:=xlByRows).Row
                    myLastCol = _
                    .Cells.Find("*", after:=.Cells(1), _
                    LookIn:=xlFormulas, lookat:=xlWhole, _
                    searchdirection:=xlPrevious, _
                    searchorder:=xlByColumns).Column
                On Error GoTo 0
                
                If myLastRow * myLastCol = 0 Then
                        .Columns.Delete
                    Else
                        .Range(.Cells(myLastRow + 1, 1), _
                        .Cells(.Rows.Count, 1)).EntireRow.Delete
                        .Range(.Cells(1, myLastCol + 1), _
                        .Cells(1, .Columns.Count)).EntireColumn.Delete
                End If
            End With
        Next wks
End Sub

HTH
~Mark
 

Forum statistics

Threads
1,140,941
Messages
5,703,301
Members
421,290
Latest member
james90

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top