I _think_ that this does what you want:
Option Explicit
Sub testme02()
Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long
Dim wks As Worksheet
Set wks = ActiveSheet
With wks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "D").End(xlUp).Row
For iRow = LastRow To FirstRow Step -1
If IsEmpty(.Cells(iRow, "e")) Then
Select Case LCase(.Cells(iRow, "D").Value)
Case Is = "mark", "brian", "karl"
'do nothing
Case Else
.Rows(iRow).Delete
End Select
End If
Next iRow
End With
End Sub
I did use column D to find the last row.
"CPower <" wrote:
Hi all,
I have a macro statement that, if a field in a certain column is blank
it will look to another column in the same row, and if that field
contains a certain name it will delete the entire row. I want a
statement that will NOT delete the row if it contains a certain name.
i.e. if any field in col E is blank look to col D and delete the entire
row if it does not contain Mark, Brian and Karl.
Can anyone please help me on this??
Thanks in advance,
Cathal.
---
Message posted from http://www.ExcelForum.com/
--
Dave Peterson