+ Reply to Thread
Results 1 to 17 of 17

Deleting Row based on number (big data)

  1. #1
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    Deleting Row based on number (big data)

    Hey all,

    Looking for a way to delete rows based on a value "0" in column B

    Here is my current code - it works really well, excpect for when I'm running 50,000 rows

    Any thoughts on a code that wont take 20 minutes for that kind of size and therefore freeze my Excel while it does the work?

    Please Login or Register  to view this content.

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

    Re: Deleting Row based on number (big data)

    This takes about 7 seconds for 62k rows.

    I replace all the 0's with blanks and then use specialCells to delete blank rows.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    Re: Deleting Row based on number (big data)

    Awesome! Great idea. Thank you

  4. #4
    Valued Forum Contributor
    Join Date
    06-29-2014
    Location
    Australia
    MS-Off Ver
    MSO 365
    Posts
    1,098

    Re: Deleting Row based on number (big data)

    Hello Jack,

    FWIW, another option would be to sort the data (sort on Column B for 0) and use the Autofilter:

    This takes about half a second on 80K rows:-

    Please Login or Register  to view this content.
    Cheerio,
    vcoolio.

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Deleting Row based on number (big data)

    Or
    Please Login or Register  to view this content.
    60,000 entries = 1/10 sec

    Maybe I should read properly. Rows need deleting. Forget above suggestion.
    Last edited by jolivanes; 10-10-2020 at 02:00 AM.

  6. #6
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Deleting Row based on number (big data)

    Hi jolivanes..

    A bit rusty.. but maybe?

    Tested with a contiguous data set with 7 columns.. change as needed.

    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Deleting Row based on number (big data)

    Thanks apo. I'll play with it.
    Much appreciated. I hope that jack.a does so also.

  8. #8
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    Re: Deleting Row based on number (big data)

    Hey theree. Been off for the last few days...

    so i retested this code
    Please Login or Register  to view this content.
    And it seems to remove all Zeroes for example it turns a cello that equals 2000 to 2, but it does delete the cells that equal zero.

    Any thoughts?

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

    Re: Deleting Row based on number (big data)

    Possibly we need to be more specific in the find/replace part.

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    Re: Deleting Row based on number (big data)

    Getting an error on this

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

    Re: Deleting Row based on number (big data)

    You need to be more specific.

    Attach a sample Wb

  12. #12
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    Re: Deleting Row based on number (big data)

    Ok attached.
    Attached Files Attached Files

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

    Re: Deleting Row based on number (big data)

    Hi jack,
    I don't get an error, what line errors for you?

    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    Re: Deleting Row based on number (big data)

    Please Login or Register  to view this content.
    These lines get highlighted

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

    Re: Deleting Row based on number (big data)

    I can't replicate the error.

    The original code in Post#2 just replaced cells that =0 it did not replace all 0's in all cells, for me.

  16. #16
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    Re: Deleting Row based on number (big data)

    It did for me originally as well, now it has decided to remove all "0"

  17. #17
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    Re: Deleting Row based on number (big data)

    working now....must've been a weird computer glitch... THANKS ALL!!

+ 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. Automatically deleting rows based upon date and/or row number
    By sjftcec in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-25-2015, 03:08 AM
  2. deleting data based on another column
    By ammartino44 in forum Excel General
    Replies: 2
    Last Post: 11-11-2014, 02:24 PM
  3. Deleting selected data based on cell value
    By Jignesh Sardesai in forum Excel General
    Replies: 4
    Last Post: 11-05-2013, 03:35 AM
  4. Deleting cells based on number of characters in a word
    By donaldc88 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-07-2012, 09:48 PM
  5. Excel 2007 : HELP - Deleting rows based on unique data
    By mikedakota43 in forum Excel General
    Replies: 1
    Last Post: 06-23-2011, 02:10 AM
  6. Deleting Rows Based on Specific Data
    By Jakz34 in forum Excel General
    Replies: 1
    Last Post: 04-12-2011, 09:00 PM
  7. Deleting rows based on number of characters
    By catalfamo1220 in forum Excel General
    Replies: 3
    Last Post: 07-20-2006, 01:31 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