Thread: Delete row
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Lift Off[_16_] Lift Off[_16_] is offline
external usenet poster
 
Posts: 1
Default Delete row


Tried another method and couldn't get it to work. Now trying the code
below. Have a sheet with 35K rows. Need to delete rows with "x" and
leave rows with "y" in column P. (I can use "1"'s or "2"'s in column P
or whatever since I'm conditioning column P.)

Dim cell As Range
Dim Arng As Range
Dim j As Long
Set Arng = Columns("P").SpecialCells(xlConstants, xlTextValues)
For j = Arng.Count To 1 Step -1
If LCase(Arng(j).Value) = "x" _
Then Arng(j).EntireRow.Delete
Next j

I've used this code elsewhere and it worked before. Code just
runs/loops forever, or is REAL slow.

Thanks.


--
Lift Off
------------------------------------------------------------------------
Lift Off's Profile: http://www.excelforum.com/member.php...fo&userid=8249
View this thread: http://www.excelforum.com/showthread...hreadid=507779