View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Deleting rows by name in cell

Dim icol As Long, i As Long
Dim lastRow As Long
Dim firstRow As Long
firstRow = 1
icol = 1 ' column A
lastRow = Cells(Rows.Count, icol).End(xlUp).Row
For i = lastRow To firstRow
If Cells(i, icol).Value = "Alan" or _
Cells(i,icol).Value = "Victor" or _
Cells(i,icol).Value = "Jason" or _
Cells(i,icol).Value = "Maria" Then
Cells(i, icol).EntireRow.Delete
End If
Next
"CPower " wrote in message
...
All the specified names that i want to delete are in column A, but when
i set icol = 1 it runs but does not work, can anyone please let me what
know what im doing wrong? not an expert on this code so it could be
somtething simple for all i know!!

Thanks guys,
Cathal.


---
Message posted from http://www.ExcelForum.com/