|
Question : Excel file size too much.How can i reduce the size.
|
|
Hi,
Excel file size too much.How can i reduce the size.
I have 8 sheets and each sheet has 20 colums and 2000 rows.And the size is 2MB. Is there any way to reduce the size.As this takes lot of time to search and filter.
Regards Sharath
|
|
Answer : Excel file size too much.How can i reduce the size.
|
|
Copy this code into your personal workbook, then run the resetallusedranges macro and see if that helps after you save the workbook:
Sub ResetAllUsedRanges() Dim wks As Worksheet For Each wks In ActiveWorkbook.Worksheets ResetUsedRange wks Next wks End Sub Sub ResetUsedRange(Optional wks As Worksheet) Dim lngLastRow As Long, lngLastCol As Long, lngRealLastRow As Long, lngRealLastCol As Long On Error Resume Next If wks Is Nothing Then Set wks = ActiveSheet lngLastRow = 1 lngLastCol = 1 With wks With .Range("A1").SpecialCells(xlCellTypeLastCell) lngLastRow = .Row lngLastCol = .Column End With lngRealLastRow = .Cells.Find("*", .Range("A1"), xlFormulas, , xlByRows, xlPrevious).Row lngRealLastCol = .Cells.Find("*", .Range("A1"), xlFormulas, , xlByColumns, xlPrevious).Column If lngRealLastRow < lngLastRow Then .Range(.Cells(lngRealLastRow + 1, 1), .Cells(lngLastRow, 1)).EntireRow.Delete If lngRealLastCol < lngLastCol Then .Range(.Cells(1, lngRealLastCol + 1), .Cells(1, lngLastCol)).EntireColumn.Delete Debug.Print .UsedRange.Count End With End Sub
Regards, Rory
|
|
|
|