View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default Conditional DeleteRow, if portion of string found

Hi All......

I have two macros, the first one works to delete rows if a cell in column H
is empty.

Sub DeleterowsNONAME()
Dim lastrow As Long, r As Long
Application.ScreenUpdating = False
lastrow = Cells(Rows.Count, "a").End(xlUp).Row
For r = lastrow To 2 Step -1
If Cells(r, "h") = "" Then
Rows(r).EntireRow.Delete
End If
Next r
Application.ScreenUpdating = True
End Sub

The second one, I'm trying to modify so if the word "trust" is found
anywhere in the cell string, to delete the entire row.....this one don't work.


Sub DeleterowsTRUST()
Dim lastrow As Long, r As Long
Application.ScreenUpdating = False
lastrow = Cells(Rows.Count, "a").End(xlUp).Row
For r = lastrow To 2 Step -1
If Cells(r, "h") = "*TRUST*" Then
Rows(r).EntireRow.Delete
End If
Next r
Application.ScreenUpdating = True
End Sub


Any help would be appreciated............using XL97
Vaya con Dios,
Chuck, CABGx3