+ Reply to Thread
Results 1 to 18 of 18

Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

  1. #1
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    Hello All,
    I'm using below code and it's running too slow apprx. 3minutes. Please help me to make it run faster if possible.

    Please Login or Register  to view this content.
    Regards,
    tt3
    Last edited by tuongtu3; 01-03-2013 at 01:32 AM. Reason: Solved

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,372

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    Why not just do an Autofilter on column X for zero values, select the visible rows (excluding the header row) and delete them?

    Regards ... and a Happy New Year


    TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    Hi TMS,
    I tried as your suggestion but it gave me "Delete entire sheet row?" and does not have an option delete "Shift Cell Up".
    I need delete Shift Cells Up base on Range R:AA only.
    Regards ...and Happy New Year to you too.

    tt3

  4. #4
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    If your cells are truly blank then see if the code below is any faster

    Please Login or Register  to view this content.
    Last edited by WasWodge; 12-31-2012 at 11:26 PM.
    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  5. #5
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    Hi WasWodge,
    Thank you for the code but it did not work as I expected. It delete the entired row and also delete blank row. To avoid confusion I need a better/faster code for below:
    Please Login or Register  to view this content.
    Regards,
    tt3

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    On 1000 lines tested, this code took 6 seconds to run

    Please Login or Register  to view this content.
    Last edited by AB33; 01-01-2013 at 05:47 PM.

  7. #7
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    Another attempt (try on a copy of your data)
    Please Login or Register  to view this content.
    Last edited by WasWodge; 01-01-2013 at 04:01 PM.

  8. #8
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    Hello WasWodge & AB33,
    Please take a look at the sample ws and I know you guys can make it run in a seconds or less (not 3 minutes like me ).

    Regards,
    tt3
    Attached Files Attached Files

  9. #9
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,519

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    This should do it

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  10. #10
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    Hi Mike,
    The code now reduces from 4 minutes 12 seconds to 1 minutes 42 seconds base on my actual ws.

    Regards,
    tt3

  11. #11
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    And another attempt
    Please Login or Register  to view this content.

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,372

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    Another variation:

    Please Login or Register  to view this content.

    Regards, TMS

  13. #13
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    I timed Trevor's filter code and seems to be the fastest one. 6 seconds! I do not think any code will beat this one.

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,372

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    Seems to be about 5 seconds on 11,000 rows on my laptop.

    Regards, TMS

  15. #15
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    @WasWodge: this is better
    @TMS: the code deletes entire row but I need delete Shift Cells Up range R:AA.

    Regards,
    tt3

  16. #16
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,372

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    1 minute 16 seconds for 12,000+ rows with this:

    Please Login or Register  to view this content.

    Regards, TMS

  17. #17
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    Hi TMS, Waswodge, AB33 & Mike:
    All codes are good and run faster than I expected. Thank you very much for all your time and help.

    Regards,
    tt3

  18. #18
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,372

    Re: Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

    You're welcome. Thanks for the rep.

+ 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