+ Reply to Thread
Results 1 to 4 of 4

Delete rows from a LARGE dataset

  1. #1
    Registered User
    Join Date
    08-08-2010
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2010
    Posts
    85

    Lightbulb Delete rows from a LARGE dataset

    Hi
    I have a code that works, but takes a LONG time (5 mins when I timed it). Have a very large dataset that needs to loop through different columns and delete rows based on criteria...

    I was hoping to find a faster way to do it since there are over 40,000 lines.

    I had seen a post that mentioned sorting the data first, but I'm not sure how this would help as the marco would still need to loop through all 40000 lines to find the info.. then go line by line to delete which is apparently where the slowness comes in when its so large.

    Here is the current code.. I have many of these as I'm doing clean-up on many columns. Any tips would be greately appreciated!
    Please Login or Register  to view this content.

  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,485

    Re: Faster way to delete rows from a LARGE dataset..?

    Why not use an Autofilter or, if necessary, an Advanced Filter to select the rows. Then delete the visible rows.

    Record a macro while you do it to get the basic code. It *will* need tweaking to generalise it. Come back if you need help.


    Regards, 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
    Registered User
    Join Date
    08-08-2010
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2010
    Posts
    85

    Re: Faster way to delete rows from a LARGE dataset..?

    Hi! I tried the autofilter but when I ran the "macro" I'd created, it deleted all the rows not only the ones filtered

  4. #4
    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,485

    Re: Faster way to delete rows from a LARGE dataset..?

    Try:

    Please Login or Register  to view this content.

    Regards, TMS

+ 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