I'm trying do a simple code to delete rows if a condition in column B & column E are met, both need to be true to have the row deleted. Column B needs to have any text and Column E has to be blank. I've tried other versions of code I've found in examples trying to troubleshoot but I can't get anything to work with 'And'. If I switch out the And to Or I get things to work but then it is deleting rows I don't want deleted. Can anyone explain what might be causing it not to work? In image attached I would want the highlighted rows to be deleted only.
Sub delete_rows()
Dim row_count As Long
Dim i As Long
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Billing")
ws.Activate
row_count = ws.Cells(Rows.Count, "A").End(xlUp).Row
i = 5
Do While i <= row_count
If Cells(i, 2) = "*" _
And Cells(i, 5) = "" Then
Rows(i).EntireRow.Delete
i = i - 1
row_count = row_count - 1
End If
i = i + 1
Loop
End Sub
Sub delete_rows()
Dim row_count As Long
Dim i As Long
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Billing")
ws.Activate
row_count = ws.Cells(Rows.Count, "A").End(xlUp).Row
i = 5
Do While i <= row_count
If Cells(i, 2) = "*" _
And Cells(i, 5) = "" Then
Rows(i).EntireRow.Delete
i = i - 1
row_count = row_count - 1
End If
i = i + 1
Loop
End Sub