+ Reply to Thread
Results 1 to 5 of 5

Please Help Improve the Efficiency of this Macro

  1. #1
    Forum Contributor
    Join Date
    05-23-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2013
    Posts
    259

    Please Help Improve the Efficiency of this Macro

    Hello Everyone!

    I've had a handful of posts the past few days (hopefully you're not all sick of me yet!).

    So this is what is going on: I have a macro to delete all rows above a specific value. In this case, a person pastes an online generated report into a specific sheet in a dashboard.

    The macro works great (and I even managed to get the two buttons on the sheet to resize and be placed where I want so they aren't eventually deleted with the rows being deleted), but the time it takes to run the macro is still far too long.

    The reason I am trying to include this macro is to future proof the dashboard against changes in the online report's layout. In the past month the report changed columns and rows slightly such that the original references no longer worked for the dashboard.

    This is my attempt at future-proofing (and it works, just too slowly).

    Please Login or Register  to view this content.
    Any assistance or alternative avenues would be greatly appreciated!

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Please Help Improve the Efficiency of this Macro

    Hi,

    Would you upload the workbook so that we can work through the macro and see its context.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    05-23-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Please Help Improve the Efficiency of this Macro

    Hi Richard,

    So I had to do a hatchet job to get this workbook to an uploadable size. The original version of this workbook had 20 numbered tabs (I cut them out so the size would go lower).

    Additionally, in the DataParse tab, the Hlookup formulas ran down to row 7500, which this tab could be a large source of the WBKs inefficiencies.

    If you have suggestions on a different way to achieve the same result I'm all ears. In the first version of this system I had a simple If the corresponding cell isn't blank on the DataPaste sheet, then the DataParse cell equals the value. But that system was prone to snags if the columns or rows changed in the online-report.

    The reason I've gone with the second DataParse tab is so users can 1. Paste directly over old data without messing up formulas 2. Sort the data according to predetermined filters/macros.

    Right now in the DataPaste I have the format set up as if a user just pasted data (but I put X's where identifying data was and shortened the list. Usually its several thousand rows long). This is exactly how it looks after a user pastes data.

    Consequently, I just tried the macro from my first post and it processed in about a second. So perhaps my problem does lie more with the hLookups and other formulas chosen.

    If you have another place I can send the fullworkbook, let me know.

    Thanks.
    Attached Files Attached Files
    Last edited by liquidmettle; 12-08-2015 at 01:24 PM.

  4. #4
    Forum Contributor
    Join Date
    05-23-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Please Help Improve the Efficiency of this Macro

    Hi Richard,

    So I experimented with deleting the Hlookups from the full workbook and they are clearly one of the main resource drains (hands down).

    Is there a suitable alternative you are aware of that is more efficient to replace them? I tried this:

    Please Login or Register  to view this content.
    But any time the macro to delete the extra rows is run, it destroys the "Match" reference and I get a #Ref Error. The Hlookups did not create errors even when rows were deleted/changed.

    But I have an idea that you might be able to help with: If I have the macro that deletes the extra rows also copy/paste the relevant columns where I want them, that might solve my issue entirely of too many formulas slowing down the workbook.

    So if you look at the columns on the DataParse tab, those are the headers I care about. There are extra ones pasted from the online generated report that do not matter.

    Is there a way to have the macro do the following:

    1. Delete the extra rows
    2. Copy all the remaining data in the columns I care about to the DataParse tab (in the order I have them on that tab currently- Some columns will go from Col A on one sheet to Col A on another, but others won't be direct). Essentially a sort of Hlookup in the macro.
    3. Still reform the buttons as I have them on the datapaste tab.
    4. Not copy the buttons to the data parse tab
    5. Make everyone Happier

  5. #5
    Forum Contributor
    Join Date
    05-23-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Please Help Improve the Efficiency of this Macro

    Hello Everyone,

    I believe I have come to a suitable solution. My final code is below. It's still slower than I'd like, but significantly faster (and more functional) than it ever was previously.

    Please Login or Register  to view this content.

+ 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. Help to improve code efficiency
    By Jactey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2015, 02:08 AM
  2. [SOLVED] Long VBA Code - Improve Efficiency?
    By Dgp2012 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-18-2013, 11:29 AM
  3. Improve efficiency of code
    By blinks in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-08-2011, 06:42 PM
  4. improve my macro efficiency
    By JieJenn in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-27-2010, 11:13 AM
  5. Removing .Select to Improve Code Efficiency
    By Mordred in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-25-2010, 01:47 AM
  6. Improve code efficiency
    By Eggert in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 11-02-2009, 07:27 AM
  7. pivottables: would like to improve efficiency
    By lalbatros in forum Excel General
    Replies: 0
    Last Post: 09-03-2007, 09:14 AM

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