Thread: Delete row
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Delete row

Hi Lift Off,

Try:

'=============
Public Sub Tester3()
On Error Resume Next
Columns("P").SpecialCells(xlConstants, xlTextValues). _
EntireRow.Delete
On Error GoTo 0
End Sub
'<<=============

---
Regards,
Norman



"Lift Off" wrote in
message ...

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