+ Reply to Thread
Results 1 to 9 of 9

Quicker function than delete entire row

  1. #1
    Registered User
    Join Date
    10-08-2010
    Location
    MK, UK
    MS-Off Ver
    Excel 2003
    Posts
    70

    Wink Quicker function than delete entire row

    Hi

    I have some example data and macro attached that has about 20,000 rows in size the real data maybe upto 100,000 rows.

    Is there a quicker way of combinig the data as per the macro using clear contents of the row and resort or some other logical test ?

    The delete entire row takes 3mins to run for the 20,000 test rows.

    Any help would be good

    Thanks
    David
    Attached Files Attached Files
    Last edited by davidparkes; 04-18-2011 at 02:15 PM.

  2. #2
    Registered User
    Join Date
    04-12-2011
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007/2010
    Posts
    67

    Re: Quicker function than delete entire row

    Try this:

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: Quicker function than delete entire row

    The fastest way to do a loop is not selecting cells, for example this code will copy and paste all the used cells into the other worksheet
    Please Login or Register  to view this content.
    I am not sure what you are doing with the other part of the code, so I am not going to get into it.
    If you attach another sample workbook showing what the desired results are to be, that would be a great benefit, you only need to provide 50 to 100 rows as the code somebody will provide to you will probably be dynamic.

  4. #4
    Registered User
    Join Date
    10-08-2010
    Location
    MK, UK
    MS-Off Ver
    Excel 2003
    Posts
    70

    Re: Quicker function than delete entire row

    Hi

    Basically if B1=B2 and C1=C2, then add the value of F2 to F1 and then delete row 2 and so on.

    This take a long time due to the delete row function.

    I was wondering if there was a better/quicker way of writing this, i.e.

    if B1=B2 and C1=C2, then add F2 to F1 and then clear contents of row 2, then check if B1=B3 and C1=C3 if so add F3 to F1 and so on, but if B1<>B2 or C1<>C2 then move down one row or to the next occupied cell in column B.

    Then I can resort which will remove the blank rows.

    I hope this makes sense.

    Thanks
    David

  5. #5
    Registered User
    Join Date
    04-12-2011
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007/2010
    Posts
    67

    Re: Quicker function than delete entire row

    Try this - I've found that unioning then removing all at once is faster than one by one:

    Please Login or Register  to view this content.

  6. #6
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Quicker function than delete entire row

    Try this:

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    02-19-2005
    Location
    Gurgaon,India
    MS-Off Ver
    2007,2010,2013
    Posts
    180

    Re: Quicker function than delete entire row

    Hi,

    Try

    Please Login or Register  to view this content.
    HTH
    Kris

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Quicker function than delete entire row

    Here is another attempt, it doesn't involve looping, it might be quicker this way.
    Please Login or Register  to view this content.

    The code could possibly be tidied a bit.

    Hope this helps
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  9. #9
    Registered User
    Join Date
    10-08-2010
    Location
    MK, UK
    MS-Off Ver
    Excel 2003
    Posts
    70

    Re: Quicker function than delete entire row

    Hi Guys

    Thankyou to you all for your help, and solutions.

    It's amazing you can have so many different ways to do the same task...

    I shall mark this as solved and add to your rep's

    Cheers
    David

+ 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