Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-30-2020, 02:58 AM
ggeoff ggeoff is offline size of Excel workbook Windows 10 size of Excel workbook Office 2016
Novice
size of Excel workbook
 
Join Date: Nov 2013
Location: Wiltshire UK
Posts: 28
ggeoff is on a distinguished road
Default size of Excel workbook

Hi



I have revised a workbook and now find that its size has gone from 50KB to 82MB. The workbook is available from: local food
Reply With Quote
  #2  
Old 08-30-2020, 06:51 AM
NoSparks NoSparks is offline size of Excel workbook Windows 10 size of Excel workbook Office 2010
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 831
NoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really nice
Default

Excessive formatting.

Happens when formatting gets applied to entire rows, entire columns or all cells of a sheet.
In particular the Apple date & ginger and the Apple pear & apricot sheets which have some kind of formatting applied all the way to cell "IV65536" (that's row 65536 column 256) but the last used cells are actually "F22" and "H24".
Need to delete the rows and columns beyond those actually being used.

After running this "Lose That Weight" macro to automatically do this for all sheets in the workbook the saved size was around 33KB.
Code:
Sub LoseThatWeight()
' saved from post #4 of:
' https://www.mrexcel.com/forum/excel-questions/961348-how-get-rid-ghost-rows-without-saving-file.html

    Dim x As Long, Lastrow As Long, LastCol As Long

    Application.ScreenUpdating = False

    On Error Resume Next

    For x = 1 To Sheets.Count
        With Sheets(x)
            Lastrow = .Cells.Find(What:="*", After:=.Range("A1"), LookIn:=xlValues, _
                          LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
            LastCol = .Cells.Find(What:="*", After:=.Range("A1"), LookIn:=xlValues, _
                          LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
            .Range(.Cells(1, LastCol + 1), .Cells(Rows.Count, Columns.Count)).Delete
            .Range(.Cells(Lastrow + 1, 1), .Cells(Rows.Count, Columns.Count)).Delete
        End With
    Next x
    On Error GoTo 0
    Application.ScreenUpdating = True
End Sub
Reply With Quote
  #3  
Old 08-30-2020, 10:15 AM
ggeoff ggeoff is offline size of Excel workbook Windows 10 size of Excel workbook Office 2016
Novice
size of Excel workbook
 
Join Date: Nov 2013
Location: Wiltshire UK
Posts: 28
ggeoff is on a distinguished road
Default

Thanks


I have never used macros. I dont know how to delete what appear to be empty cells.
Reply With Quote
  #4  
Old 08-30-2020, 11:24 AM
NoSparks NoSparks is offline size of Excel workbook Windows 10 size of Excel workbook Office 2010
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 831
NoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really nice
Default

You don't have to use the macro, you can do it manually.


Here's your file already done
Attached Files
File Type: xlsx chutney-calculator.xlsx (32.0 KB, 7 views)
Reply With Quote
  #5  
Old 08-31-2020, 03:19 AM
ggeoff ggeoff is offline size of Excel workbook Windows 10 size of Excel workbook Office 2016
Novice
size of Excel workbook
 
Join Date: Nov 2013
Location: Wiltshire UK
Posts: 28
ggeoff is on a distinguished road
Default

Thanks. How could I have doe it manually, in case I make the same mistake in future? Thanks once again for sorting this issue
Reply With Quote
  #6  
Old 08-31-2020, 04:29 AM
Purfleet Purfleet is offline size of Excel workbook Windows 10 size of Excel workbook Office 2019
Expert
 
Join Date: Jun 2020
Location: Essex
Posts: 345
Purfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to behold
Default

You just need to select the unused columns > right click delete and then unused rows > right click delete


for example on the 'Apple date & ginger chutney' worksheet select column H, press ctrl & shift, right arrow (all columns will be selected) then right click and delete. For rows select row 23, ctrl & shift, down arrow (all rows will be selected) then right click delete.

That is all the macro is doing, but all all sheets, much faster than we can so manually
Reply With Quote
  #7  
Old 08-31-2020, 07:25 AM
ggeoff ggeoff is offline size of Excel workbook Windows 10 size of Excel workbook Office 2016
Novice
size of Excel workbook
 
Join Date: Nov 2013
Location: Wiltshire UK
Posts: 28
ggeoff is on a distinguished road
Default

Thanks Purfleet, I have done that to all the worksheets but the workbook size is still 82MB. I picked on a cell at random and found that on the Format menu the cell was locked, perhaps I should go through all sheets and unlock selected cells?
Reply With Quote
  #8  
Old 08-31-2020, 08:33 AM
Purfleet Purfleet is offline size of Excel workbook Windows 10 size of Excel workbook Office 2019
Expert
 
Join Date: Jun 2020
Location: Essex
Posts: 345
Purfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to behold
Default

Shouldnt need to. Just select the Apple date & ginger chutney sheet select H (so the whole column is selected) and ctrl shift right arrow, right click and delete. I just did it and saved and it was reduced to 42mb
Reply With Quote
  #9  
Old 08-31-2020, 09:46 AM
ggeoff ggeoff is offline size of Excel workbook Windows 10 size of Excel workbook Office 2016
Novice
size of Excel workbook
 
Join Date: Nov 2013
Location: Wiltshire UK
Posts: 28
ggeoff is on a distinguished road
Default

I cant understand it. I get no resulting reduction in size but I am getting a flashing message along side a white Sign in box- that has appeared recently- the message is "Not Responding".
Reply With Quote
  #10  
Old 08-31-2020, 09:58 AM
Purfleet Purfleet is offline size of Excel workbook Windows 10 size of Excel workbook Office 2019
Expert
 
Join Date: Jun 2020
Location: Essex
Posts: 345
Purfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to behold
Default

That sounds like a resource issue, but you are running win 10 and excel 2016 (according to your profile) so i assume you have a relatively decent PC


Are you doing the update in excel online or from the server version of the file?
Trying opening the file from your PC (it takes about 15 seconds to open on my PC and then another 15 to enable editing) then try the steps
Reply With Quote
  #11  
Old 08-31-2020, 10:27 AM
ggeoff ggeoff is offline size of Excel workbook Windows 10 size of Excel workbook Office 2016
Novice
size of Excel workbook
 
Join Date: Nov 2013
Location: Wiltshire UK
Posts: 28
ggeoff is on a distinguished road
Default

I have a Dell 690 and 2 TB hardrives C: drive is an SSD and one of the hard drives is in a mirror (2x2TB) Intel Xeon E5345. Internet slow but the workbook is on my PC. Windows 10 up to date. NoSparks kindly cleaned the workbook fo me so I can use that to replace the one on the website. I am using Windows Defender which is up to date.
Reply With Quote
  #12  
Old 08-31-2020, 11:05 AM
Purfleet Purfleet is offline size of Excel workbook Windows 10 size of Excel workbook Office 2019
Expert
 
Join Date: Jun 2020
Location: Essex
Posts: 345
Purfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to beholdPurfleet is a splendid one to behold
Default

Yeah, so decent enough pc.



I dont have any problems cleaning the file, so i would just make sure it in the local file. maybe re-dlownload it and do the clean up on that file?
Reply With Quote
  #13  
Old 08-31-2020, 11:41 AM
NoSparks NoSparks is offline size of Excel workbook Windows 10 size of Excel workbook Office 2010
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 831
NoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really nice
Default

When clicking on a cell and looking at its Protection under format cells...
default setting is locked... but is only locked IF the sheet is protected.

When you delete the rows and columns as Purfleet has described the size won't reduce until Excel re-establishes the used range of the sheets which it does upon closing and saving the file.
Reply With Quote
  #14  
Old 09-01-2020, 07:53 AM
ggeoff ggeoff is offline size of Excel workbook Windows 10 size of Excel workbook Office 2016
Novice
size of Excel workbook
 
Join Date: Nov 2013
Location: Wiltshire UK
Posts: 28
ggeoff is on a distinguished road
Default

Hi NoSparks I was running another Excel workbook at the same time so I do not think that helped. Closing all Excell workbooks and restarting and then going through the delete unused rows and columns and saving and closing still doesn't reduce the workbook size. The file is being saved as i set up a test workbook and deleted one of the spreadsheets after anther and the file size started to reduce, particularly with the deletion of Tomato and Apples. The size of the spreadsheets are no more than 3K each and then a massive drop to 41MB.
Reply With Quote
  #15  
Old 09-01-2020, 10:23 AM
NoSparks NoSparks is offline size of Excel workbook Windows 10 size of Excel workbook Office 2010
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 831
NoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really nice
Default

Sorry Geoff, I have no idea as to how or what you're doing.

Here's what I did:

Downloaded the file you linked to in post 1, (82.4 MB) to a folder on my hard drive.

Starting with no workbooks open, opened your file (took 62.6 seconds)

hit Alt + F11 to bring up the VBA environment
clicked Insert and selected Module
pasted the macro of post 2 into the module.

Went back to the Spreadsheet.
hit Alt + F8 to bring up the Macro dialogue
Selected the only macro available "LoseThatWeight" and clicked Run.

Things ground away for over a minute then came back to life.

Clicked the X in top right corner to close the workbook
was asked if wanted to make changes to 'chutney-calculator.xlsx
selected save
get a pop-up saying VB project can't be saved in a macro-free workbook...
To continue saving as a macro-free workbook, click Yes
I clicked Yes and Excel saved the workbook and closed it.

Looking in the folder where the workbook was downloaded to its size is now 33 KB and it loads in a second.
Reply With Quote
Reply

Tags
excel 2016, size, workbook



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I copy a workbook to another workbook and keep the formatting within the new workbook excelforsue Excel 3 09-15-2020 03:37 AM
Printing orientation - Excel Workbook amason Excel 3 05-14-2017 10:10 PM
size of Excel workbook Export Project in Excel Workbook codeghi Project 3 09-28-2016 11:32 AM
How to add attached excel workbook with hyperlink in the same workbook lynchbro Excel Programming 0 02-24-2015 01:29 PM
Shared Excel workbook eguru2 Excel 0 07-12-2011 12:02 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:54 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft