ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Rows With Specific Text or Values (https://www.excelbanter.com/excel-programming/371807-delete-rows-specific-text-values.html)

Sean[_15_]

Delete Rows With Specific Text or Values
 
I always am making posts and asking questions. I appreciate all the help I
always receive. My next one seems fairly easy although I just cant get it.

I want to delete rows with specified text or values in column "A". Such as,

If A1:A10000 = "----*" or "000*" or "For acct*" Then entire row delete.

Thanks,

Sean

Ed

Delete Rows With Specific Text or Values
 
Hi, Sean. Try this - but please try it on a COPY of your data first.

Ed

Sub Foo_Test1356()

Dim rng As Range
Dim cll As Range
Dim x As Long

x = 0
Set rng = ActiveSheet.Range("A1:A10000")
For Each cll In rng.Cells
If cll.Text = "----*" _
Or cll.Text = "000*" _
Or cll.Text = "For acct*" Then
cll.EntireRow.Delete
x = x + 1
End If
Next cll

MsgBox "Deleted " & x & " rows."

End Sub

"Sean" wrote in message
...
I always am making posts and asking questions. I appreciate all the help I
always receive. My next one seems fairly easy although I just cant get
it.

I want to delete rows with specified text or values in column "A". Such
as,

If A1:A10000 = "----*" or "000*" or "For acct*" Then entire row delete.

Thanks,

Sean





All times are GMT +1. The time now is 07:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com