+ Reply to Thread
Results 1 to 11 of 11

Slow deletion of filtered region

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Slow deletion of filtered region

    Below I've posted a snippet of code that's giving me trouble. The snippet comes at the end of a long procedure of configuring a pivot, converting it to values, and populating it with a formula that results in either "Delete" or "Keep", then sorting by "Delete" and "Keep", then filtering to "Delete". All of that goes quickly. Then we try to Delete the "Delete" lines. That little step takes approximately 15 minutes, and I can't figure out why. Screenupdating, calculations, alerts are all turned off, and there's no error message. the code completes, it takes forever to do the deletion. There ARE 352K lines, so I could understand a small delay, but that long means to me that something's wrong. Any ideas?
    Please Login or Register  to view this content.
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: Slow deletion of filtered region

    I suspect you'd find it quicker to use:

    Please Login or Register  to view this content.
    Rory

  3. #3
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Slow deletion of filtered region

    I'll try that as soon as my macro finishes. Is it because, as it's written now, the deletion is cell by cell, rather than entire rows at a time?

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: Slow deletion of filtered region

    I imagine that is the main cause, yes.

  5. #5
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Slow deletion of filtered region

    Well, it was a good idea, but it doesn't seem to be bearing fruit. it's been running about 10 minutes so far, and I'm about to leave work for the day, so I'll try to get back to it tomorrow.

    I'm wondering; would it make it any better to select the range, then do a "selection.entirerow.delete"?

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: Slow deletion of filtered region

    It shouldn't. Is it a regular range or a table?

    Also, you did change the range to just one column?

  7. #7
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Slow deletion of filtered region

    it's just a regular range. here's the entire macro, in case you can spot something else I'm doing wrong. But by putting STOP points, I can see that all steps proceed quickly, until we come to deletion.
    That takes forever.

    Please Login or Register  to view this content.

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: Slow deletion of filtered region

    If you stop the code at that point and delete the rows manually, how long does it take?

  9. #9
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Slow deletion of filtered region

    Now THAT was a good question to ask! I just tried it; the manual deletion has so far taken 15 minutes, and I'm about to kill it. Could it be because the Workbook itself is huge, with multiple pivots all based on an external source? Would it be better to copy my data to a new WB and do the deletion there?

  10. #10
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: Slow deletion of filtered region

    It's worth a shot. Off the top of my head I can't see why it should take that long on manual calculation.

  11. #11
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Slow deletion of filtered region

    So I changed my macro around; I filter out some stuff in the pivot now, which reduces the lines from 352K to about 250K. I then convert my pivot to values, move that sheet into a new workbook, close the old source workbook, THEN delete the lines. everything before the deletion takes about a minute. The Deletion is still taking almost 15 minutes. I give up!

+ 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. [SOLVED] Advanced Filter copy to range. columns rearranged
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-22-2019, 01:00 PM
  2. Slow When Filtered
    By Proudcdn1 in forum Excel General
    Replies: 19
    Last Post: 12-09-2017, 04:46 PM
  3. Replies: 2
    Last Post: 06-01-2015, 06:23 PM
  4. Replies: 4
    Last Post: 05-17-2012, 06:30 PM
  5. Replies: 1
    Last Post: 10-04-2007, 12:04 PM
  6. Replies: 2
    Last Post: 05-29-2006, 12:30 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