Results 1 to 8 of 8

delete entire row if 'value' found anywhere in column - most efficient way?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    06-29-2011
    Location
    Scotland
    MS-Off Ver
    Excel 2003
    Posts
    122

    delete entire row if 'value' found anywhere in column - most efficient way?

    Ive got the code below doing what i want, which is to delete an entire row if 'Unsettled' is found anywhere in a particular column.

    Is there a more efficient way to do this when the number of rows is large?

    Dim Counter As Long
    
    Cells(2,colNum).Select    ' Starting point, row 2 in column 'colNum'
    
     For Counter = 1 To 25000     ' need to change 25000 to lastRow later
      If ActiveCell.Value Like "Unsettled" Then
       ActiveCell.EntireRow.Delete     ' Delete Row if 'Unsettled' is found in colNum
        Else
         ActiveCell.Offset(1, 0).Select     ' Move down a row
          End If
      Next Counter
    Last edited by intothewild; 11-24-2012 at 02:18 PM.

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