+ Reply to Thread
Results 1 to 5 of 5

Looped Find & Delete row, Code works but too slow

  1. #1
    Registered User
    Join Date
    10-14-2013
    Location
    Saturn
    MS-Off Ver
    Excel 2010
    Posts
    28

    Looped Find & Delete row, Code works but too slow

    Hi,
    My data set is >320,000 rows deep, 45 columns. There is column headed by "Record Status Code" populated by "1" or "3". Another column "Transaction ID" has a number in string format.

    My instructions were:
    "9. All claims with RecordStatus = 3 are reversals. We need to remove them, along with the original claim they reversed. To find the original claim, look at the Transaction ID for the reversal, and replace the last digit (1) with a 0."

    In other words, for every row with Record Status Code = "3", also find the row containing Transaction ID with altered last digit, and delete both rows.

    I wrote a code that seems to work. However, it takes way too long. Is there an alternative/optimized method?


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Looped Find & Delete row, Code works but too slow

    Can you upload a copy of your workbook?

  3. #3
    Registered User
    Join Date
    10-14-2013
    Location
    Saturn
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Looped Find & Delete row, Code works but too slow

    Quote Originally Posted by stnkynts View Post
    Can you upload a copy of your workbook?
    Hi.

    The file is too large. Also full of PI's. It's for work

  4. #4
    Registered User
    Join Date
    10-14-2013
    Location
    Saturn
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Looped Find & Delete row, Code works but too slow

    Quote Originally Posted by stnkynts View Post
    Can you upload a copy of your workbook?
    Here it is, stripped of the other 40+ columns and reduced the row count from 320,000+ to <100,000.

    Help appreciated.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Looped Find & Delete row, Code works but too slow

    It would have been helpful to at least include the Transaction ID with its relevant column. What I was going to do was autofilter for the number 3 then loop through and correct the 0 (or possibly use match depending of a couple of factors). Your initial post was very confusing though, which is why I asked for the workbook (e.g., I don't see why you have to delete and entire row twice when it appears to be on the same row). Either way, best of luck with you query.

+ 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. Code to delete rows only works sometimes
    By BartSeli in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-18-2013, 01:41 PM
  2. Replies: 12
    Last Post: 01-01-2013, 02:54 AM
  3. Looped Macro to delete data
    By damo_uk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-17-2009, 01:43 PM
  4. [SOLVED] Code works but is slow except when....
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-03-2006, 04:35 AM
  5. Code works, but is slow
    By EMoe in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-25-2005, 05:08 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