+ Reply to Thread
Results 1 to 3 of 3

Code to delete row based on len of cell

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

    Code to delete row based on len of cell

    Hey,

    So here is the code I'm using, im usually running it on about 20k cells at a time.

    is there a way to speed up this code?

    thank you!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,943

    Re: Code to delete row based on len of cell

    Deleting rows is the worst process for Excel to handle - it has always been problematic. After every row deletion, Excel rebuilds its calculation tree, and that is a process that takes time.

    The key is to use a column of formulas to label the correct rows for deletion, then sort the data based on the formula to group the rows needing deletion into one block - one deletion, one rebuild of the calculation tree.

    Code is this, based on yours with some of my other preferred changes:

    Please Login or Register  to view this content.
    Last edited by Bernie Deitrick; 04-15-2021 at 05:24 PM.
    Bernie Deitrick
    Excel MVP 2000-2010

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

    Re: Code to delete row based on len of cell

    Thank you so much! works like a charm!

+ 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. VB code to insert/delete number of rows based on cell value
    By shreeja178 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-05-2018, 04:26 AM
  2. [SOLVED] Code to delete row based of cell criteria
    By Excelski in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2017, 09:35 AM
  3. [SOLVED] Help with Code to delete selected ran=ge based on Value of the cell
    By rv02 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-20-2016, 12:36 PM
  4. VBA code to delete the FILTERED range and moving the cell up (dont Delete entire row)
    By mchilapur in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2015, 07:48 AM
  5. [SOLVED] VB code to delete value in a cell based on finding another Value
    By psoft in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-28-2014, 09:51 AM
  6. VBA code to find and delete cell contents based on userform combobox selections
    By anfdrew in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-06-2013, 04:13 PM
  7. Code to delete rows based on status code in Column I
    By LemonTwist in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-26-2009, 07:01 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