+ Reply to Thread
Results 1 to 7 of 7

Cleaning and Making an Excel file Efficient

  1. #1
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    546

    Cleaning and Making an Excel file Efficient

    In our organization we have a very large file with lots of tabs, links, statistics and lots of formulas. It was 30 MB before i saved it in binary format, now its about 10MB. I honestly do believe that there are things in there that still could be cleaned up but I just don't know where to begin. I know changing the format to binary was a big step but I am also wondering if there is anything else in there that I can do to clean up this file so that its as small as possible and smooth as possible. It crashed on me a few times and once I roll this out I don't want it to be a regular thing. This file relates to employees compensation so its obviously highly sensitive. If anyone has a utility or any experience with this that could provide some experienced help I would greatly appreciate your help.

    Thank you for letting me post.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Cleaning and Making an Excel file Efficient

    From this old thread:

    Quote Originally Posted by JBeaucaire View Post
    1) Use the SELECT OBJECTS option and draw large selection areas, see if there are some hidden objects on the workbook that are being duplicated invisibly.

    2) Instead of deleting formulas, do a CLEAR ALL on the cells outside the data range.

    3) Conditional formatting rules can spin out of control
    Here's an old macro I used a few times to reduce the filesize on some troublesome workbooks:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    546

    Re: Cleaning and Making an Excel file Efficient

    Jerry Forgive me but I am a macro novice. do I need to change ---- fSize = FileLen(ThisWorkbook.Name)----- to the name of my file?
    I am getting an error. I have a lot to learn about Macros. I know only the very very very basics - if that.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Cleaning and Making an Excel file Efficient

    No, the ThisWorkbook.Name is a builtin function and will fill itself in based on the workbook in which you install the code.

    To add the code:
    1. open the VBEditor (ALT+F11)
    2. Insert a new module (Insert > Module)
    3. Paste the code into the module that appears

    Run the macro and it should do it's thing. When you receive errors, DEBUG and make note of the line of code that is highlighted in yellow, we need to know what that is to guess at what might be wrong. But it's a pretty basic macro.

    The version of the macro I gave you uses column A and row 1 to determine the boundaries of the data.

    Here's another version that uses a "search" method on each sheet, it might work better:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    546

    Re: Cleaning and Making an Excel file Efficient

    I ran the last code and it was running and then it said:

    Run time error '11004': Cannot change part of a merged cell.

    When I pressed Debug it then highlighted the following line.

    Range(Cells(i, Columns.Count).End(xlToLeft).Offset(0, 1), Cells(i, Columns.Count)).Clear

    When I looked at some of the tabs it looks like it changed the structure of some of the worksheets. Looks like it un-merged some things.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Cleaning and Making an Excel file Efficient

    I hope you're testing on a COPY of your file.

    Odd, the second one is designed to find the last used cell on each sheet, then do a CLEAR ALL on all the cells outside that used range.

    Merged cells are always a bit of a pain. But I'm at a loss without seeing your workbook as to why the macro is even affecting the used portion of the sheets. I'd have to see it to uncover what's happening.

    If you want to share a link to your file secured on a OneDrive or something, I'd be happy to check it out. You can PM me with the link.

  7. #7
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    546

    Re: Cleaning and Making an Excel file Efficient

    Thank you for trying to help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. New to Excel Programming and need help making my macros more efficient
    By odoualex in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-01-2013, 11:01 AM
  2. Need help making file more efficient (processing speed)
    By lilvictorians in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-24-2013, 07:33 PM
  3. Help on cleaning up code and make it more efficient.
    By tandi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-17-2012, 11:24 AM
  4. [SOLVED] Help on cleaning up code and make it more efficient.
    By tandi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-24-2012, 06:24 PM
  5. making code more Efficient !!! please help
    By virgiliocabrera in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-01-2011, 09:09 PM
  6. making code more efficient
    By JChandler22 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-31-2008, 05:11 PM
  7. Making an excel formula more efficient
    By excel1000 in forum Excel General
    Replies: 2
    Last Post: 03-16-2008, 02:47 PM

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