Do not use on any
shared computer
July 24, 2008 08:36pm pdt
null
[x]
Attachment Details

Large Excel file - how to reduce the size?

Tags: excel, file, size, reduce, large
I have an Excel file with UsedRange = A1:CH102. The saved size is 4151 kB. I have found a way to reduce the size:

Option Base 1

Sub ReduceSize()
  Dim lAntR As Long
  Dim iAntK As Integer
  Dim aR() As Single
  Dim aK() As Single
  Dim n As Integer
  Dim sFil1 As String
  Dim sFil2 As String
  Dim sKat As String
  Dim sArk As String
 
  sFil1 = ActiveWorkbook.Name
  sKat = ActiveWorkbook.Path
  sArk = ActiveSheet.Name
 
  lAntR = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
  iAntK = Cells.Find(What:="*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
 
  ReDim aR(lAntR)
  ReDim aK(iAntK)
  For n = 1 To lAntR
    aR(n) = Rows(n).RowHeight
  Next n
  For n = 1 To iAntK
    aK(n) = Columns(n).ColumnWidth
  Next n
 
  Application.CutCopyMode = False
  Range(Cells(1, 1), Cells(lAntR, iAntK)).Copy
  Workbooks.Add
  sFil2 = ActiveWorkbook.Name
  ActiveSheet.Name = sArk
  ActiveSheet.Paste
  Application.CutCopyMode = False
 
  For n = 1 To lAntR
    Rows(n).RowHeight = aR(n)
  Next n
  For n = 1 To iAntK
    Columns(n).ColumnWidth = aK(n)
  Next n
 
  Workbooks(sFil1).Close savechanges:=False
  Application.DisplayAlerts = False
  Workbooks(sFil2).SaveAs sKat & "\" & sFil1
  Application.DisplayAlerts = True
End Sub

But still the size is about 1400 kB.
Do anybody know what was occupying space outside the UsedRange?
Do anybody know what kind of format or content or anything else which takes much space? Is there a way to analyse the size of each cell or element in the sheet?

Start your free trial to view this solution
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Question Stats
Zone: Software
Question Asked By: smeden
Solution Provided By: XL-Dennis
Participating Experts: 7
Solution Grade: B
Views: 1017
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by MalicUK

Rank: Genius

Expert Comment by MalicUK:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by smeden
Author Comment by smeden:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Assisted Solution by MalicUK

Rank: Genius

Assisted Solution by MalicUK:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Assisted Solution by DrewK

Rank: Master

Assisted Solution by DrewK:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Assisted Solution by byundt

Rank: Genius

Assisted Solution by byundt:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Assisted Solution by tapankhatri
Assisted Solution by tapankhatri:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by XL-Dennis

Rank: Guru

Expert Comment by XL-Dennis:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by smeden
Author Comment by smeden:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by XL-Dennis

Rank: Guru

Expert Comment by XL-Dennis:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by smeden
Author Comment by smeden:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Accepted Solution by XL-Dennis

Rank: Guru

Accepted Solution by XL-Dennis:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by Andy_Bethell
Expert Comment by Andy_Bethell:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by MalicUK

Rank: Genius

Expert Comment by MalicUK:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by Andy_Bethell
Expert Comment by Andy_Bethell:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by roameri
Expert Comment by roameri:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Administrative Comment by byundt

Rank: Genius

Administrative Comment by byundt:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by roameri
Expert Comment by roameri:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34