Hi MalicUK
There are many formulas in my sheet, so maybe I cannot reduce the size more than that. But I often find that the UsedRange reaches farther down and to the right than the range that really has content. Then it is no help to delete the actual columns or rows. The only way I have found to get a cleaner sheet is to copy the content to a new sheet, as I showed in the code. But it is a risk to lose some information, e.g. my code loses the print area.
Main Topics
Browse All Topics





by: MalicUKPosted on 2004-12-09 at 07:01:34ID: 12783819
Hi smeden,
What is in those cells. Are there many formula? If so then it -could- be that. If there are no formula and the cells just contain data, then how much data is there. The following sub will tell you the total length of all the text in your sheet. Then you need to think about the formatting and pictures etc. does it come close?
Sub CountAllText()
Dim Cel As Range
Dim ws As Worksheet
Dim result As Integer
For Each ws In ActiveWorkbook.Worksheets
For Each Cel In ws.UsedRange
result = result + Len(Cel.Formula)
Next
Next
msgbox result
End Sub
Cheers,
MalicUK.