Jump to content

Recommended Posts

Posted

I have an Excel file with growing size. I read before that it is possible to delete unnecessary dates, like history which is safed along with the file. I heared it is possible to reduce to the half filesize and there are tools for that.

I googled for that but did not find anything usefull. Anyone here has an idea?

Posted

Unfotunately Excel does not have a 'compact' function like Access does :o

Usually the cause of file bloat is that Excel thinks the data is bigger than

it really is.

Try this on a COPY of your file, just in case disaster strikes.

You know the last column of your data and the last row. The cell at the

bottom right of this range is the last cell of your actual data.

Now do Ctrl - End

That takes you to the cell that Excel thinks is the last cell of your data. If they differ significantly do this:-

In the Name box of your sheet (usually right above column A) type X:65536

where X is the row number immediately below the last row of your actual

data.

Hit Enter. This will select every cell below your last data.

Do Edit - Clear - All. This clears every row below your actual data.

In the same Name box type X:IV where X is the column letter of the column

immediately to the right of the last column of your actual data.

Hit Enter. This will select every cell to the right of your last data.

Do Edit - Clear - All. This clears every column to the right of your actual data.

Save the file.

Close the file.

Open the file.

Repeat for each worksheet.

Worth a shot, as always YMMV.

"I don't want to know why you can't. I want to know how you can!"

Posted

I'll try that!

Thanks a lot :D

Unfotunately Excel does not have a 'compact' function like Access does  :o

Usually the cause of file bloat is that Excel thinks the data is bigger than

it really is.

Try this on a COPY of your file, just in case disaster strikes.

You know the last column of your data and the last row. The cell at the

bottom right of this range is the last cell of your actual data.

Now do Ctrl - End

That takes you to the cell that Excel thinks is the last cell of your data. If they differ significantly do this:-

In the Name box of your sheet (usually right above column A) type X:65536

where X is the row number immediately below the last row of your actual

data.

Hit Enter. This will select every cell below your last data.

Do Edit - Clear - All. This clears every row below your actual data.

In the same Name box type X:IV where X is the column letter of the column

immediately to the right of the last column of your actual data.

Hit Enter. This will select every cell to the right of your last data.

Do Edit - Clear - All. This clears every column to the right of your actual data.

Save the file.

Close the file.

Open the file.

Repeat for each worksheet.

Worth a shot, as always YMMV.

Posted

strange it made the filesize from 8.24 MB to 13.2 MB..... :o

so next idea, please hahahaha....

Unfotunately Excel does not have a 'compact' function like Access does  :D

Usually the cause of file bloat is that Excel thinks the data is bigger than

it really is.

Try this on a COPY of your file, just in case disaster strikes.

You know the last column of your data and the last row. The cell at the

bottom right of this range is the last cell of your actual data.

Now do Ctrl - End

That takes you to the cell that Excel thinks is the last cell of your data. If they differ significantly do this:-

In the Name box of your sheet (usually right above column A) type X:65536

where X is the row number immediately below the last row of your actual

data.

Hit Enter. This will select every cell below your last data.

Do Edit - Clear - All. This clears every row below your actual data.

In the same Name box type X:IV where X is the column letter of the column

immediately to the right of the last column of your actual data.

Hit Enter. This will select every cell to the right of your last data.

Do Edit - Clear - All. This clears every column to the right of your actual data.

Save the file.

Close the file.

Open the file.

Repeat for each worksheet.

Worth a shot, as always YMMV.

Posted
strange it made the filesize from 8.24 MB to 13.2 MB.....  :o

so next idea, please hahahaha....

Oops, at least it changed the filesize :D:D

"I don't want to know why you can't. I want to know how you can!"

Posted

Try this:

Sub ReduceFilesize()

' 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

Posted
I found the above macro somewhere and I tried it but seems to be an error in it.

The error was because of a conflict with another macro I have. Should be fine.

Running it on a spreadsheet 1.2 meg reduced it to 900k. Great!

YBB

Posted

Open your sheet,

then on the top bar menu :

File>save as

select tab delimited, or CSV, or text (depend of the versin of excel)

give a new name (in case of )

save.

Close all

Reboot

unplug the computer, go to your favorite bar and take a beer (joking)

After reboot, open excell then import data (or just drag and drop the text file you have created in Excell)

you should have a new spreadsheet will only your data (Assuming you are looking only for that).

Another way is to convert it in Acees format, then clean it with Access, and then save the cleaned speadsheet from Access as a Excell file (in that case you will keep the macro)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.


  • Topics

  • Popular Contributors

  • Latest posts...

    1. 22

      Thailand Live Thursday 20 February 2025

    2. 0

      British and German Nationals Arrested in Thailand for Sexual Abuse of Children

    3. 31

      Trump popularity sinks as Americans quickly sour on economy: poll

    4. 22

      Thailand Live Thursday 20 February 2025

    5. 0

      Man Shot Dead by Police After Attacking Village Head with Machete in Nakhon Si Thammarat

  • Popular in The Pub


×
×
  • Create New...