+ Reply to Thread
Results 1 to 15 of 15

File size issue

  1. #1
    Forum Contributor
    Join Date
    03-27-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    290

    File size issue

    I have two documents, one with a macro in and one with the data in that i manipulate with the macro and send out to other people.

    The file in which i use the macro on is aprox 5mb to start with

    when the macro is used it increases to almost 25mb and all it has done is added around 8000 cells of data and deleted 37,000 cells on the original 44,827 cells of data (4 new tabs are created and 3 tabs are deleted)

    why does it increase so much in size? even if i copied everything on the original sheet and didnt delete anything 4x i still should only end up with a MAXIMUM of 20mb, why after deleting loads of cells and re-arranging/filtering them does it increase by almost 5x? Is there a possible way to decrease the size of the data before saving it as the excel file?

    thanks in advance

  2. #2
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: File size issue

    the macro is probably leaving alot of blank space after your data, you can test this by using the scroll bars to scroll to the end of their range, both right and down, and it will show you the area that is being saved. to remove the unused rows, you can delete them in your macro.

    you also may be able to reduce the size of your files by saving in the XLSB format.
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  3. #3
    Valued Forum Contributor
    Join Date
    03-14-2012
    Location
    Arizona USA
    MS-Off Ver
    Excel 2000/2007
    Posts
    408

    Re: File size issue

    Unwanted/unexpected large file sizes are usually the result of too much formatting or too much worksheet functions.

    I would check to see if entire(max size) rows or columns are getting formatted. If they are, then adjust your macros to format the least amount and delete the unused cells.

  4. #4
    Forum Contributor
    Join Date
    03-27-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: File size issue

    is there any way to see the extra cells that are being saved? or a way to delete all unused rows/columns?

    i did the macro again with a different data range and got a similar figure for the size... im thinking that the columns are fine but the rows are not...

    the sheet im using the macro on can change in size every week so i cannot put a definitive figure on how many rows i need to go up to, id prefer to have the option to select all rows with no data in it to delete if thats possible?

    thanks again

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: File size issue

    Hit Ctrl & End to see where the worksheet ends, if it is way past where the actual data is, refer to post #2
    Select all of the unused rows by selecting the row below the last used row and hit Ctrl & down until you are at the bottom of the sheet. Then right click and select delete.
    Select the first unused Column after the last used column and hit Ctrl&right until you are at the end of the sheet, right click and select delete.
    Re-save the sheet. The file should end up smaller.

  6. #6
    Forum Contributor
    Join Date
    03-27-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: File size issue

    is it possible to select this data via macro? the issue being i select columns like (A:A) which im assuming creates all that unnecessary data. is it possible to select last used row via macro?

    also CTRL + SHIFT + Down will highlight all rows until the end, ctrl+down just takes you to the last row =)

  7. #7
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: File size issue

    to find the row number of the last used row, you can use something like this:

    Please Login or Register  to view this content.
    and to delete all rows bellow that somethign like this:

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    03-27-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: File size issue

    Quote Originally Posted by DGagnon View Post
    and to delete all rows bellow that somethign like this:

    Please Login or Register  to view this content.
    once the term "last row" is defined can i use it elsewhere, for example if i wanted to select all the data in a column i could use something like
    Please Login or Register  to view this content.

  9. #9
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: File size issue

    yes, but you would have to modify that range selection like this

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    03-27-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: File size issue

    the issue comes from this part in the macro

    Please Login or Register  to view this content.
    as you can see selecting lots of whole columns seemed like an easy way to start up the macro but caused a large file size in the end.
    maybe setting something like...

    Please Login or Register  to view this content.
    would prove to be a better way of copying the data i need without leaving loads of space unaccounted for.

  11. #11
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: File size issue

    do all columns have the same number of rows?

  12. #12
    Forum Contributor
    Join Date
    03-27-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: File size issue

    not filled in no... Column B is a reference number though so however many rows are in column B is the number of rows i want to copy...

    the sheet is used as a data logger and if the issue/data doesnt require a certain column to fill in then that is ok however column B will always be filled in.

    obviously week to week the number of rows may change so i dont want just a fixed value like.... (A1:A1000)

  13. #13
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: File size issue

    based on the number of columns you are selected i would still copy over the full rows, then delete unused portion after

    try adding this to the end of your macro or the last section where the new workbook/sheet is active.

    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    03-27-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    290

    Re: File size issue

    thank you! this worked =) thanks very much

  15. #15
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: File size issue

    no problem, im glad i could help.

    could you pleae mark this thread as solved? there should be an option in thread tools at the top.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1