View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
CPower[_4_] CPower[_4_] is offline
external usenet poster
 
Posts: 1
Default Deleting rows by name in cell

Thanks a millon Tom.

I understand whats happening in the code but for some reason when i run
it nothing happens i.e does not delete the rows of the specified people
= If Cells(i, icol).Value = "Alan, Victor, Jason, Maria". Can u help me
with this?

here is the code as i put it in:

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, Victor, Jason, Maria" Then
Cells(i, icol).EntireRow.Delete
End If
Next

Regards
Cathal.


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