Hi, I wonder whether someone could help me please.
I'm trying to create a short script which performs the following:
- Searches for a specific name in column C on my "Resource List" sheet, then
- When this is found, check column H to see if this is populated,
- Then when both criteria are met delete the entire row.
Using a link I found herehttp://www.ozgrid.com/forum/showthread.php?t=64364, I've put together the code below:
Sub Delete_row()
Dim LastRow As Long
Dim iLoop As Long
Dim ws As Worksheet
Set ws = Sheets("Resources List")
With ws
LastRow = ActiveSheet.Range("B65536").End(xlUp).Row + 1
For iLoop = Last_Row To 1 Step -1
If (Trim(ActiveSheet.Cells(iLoop, 3).Value) = "Bloggs, Joe") And (Trim(ActiveSheet.Cells(iLoop, 7).Value) > 0) Then
ActiveSheet.Cells(iLoop, 3).EntireRow.Delete
End If
Next iLoop
End With
End Sub
The problem I have is that although the criteria are being met the row is not being deleted.
I just wonderd whether someone may be able to look at this please and let me know where I'm going wrong.
Many thanks and kind regards
Chris
Bookmarks