Hello
Please see attachment for example data.
I have a code that searches in column B and if the cell contains either the words "Employee" or "Overall Total:", then it deletes the entire row.
Sub Remove_Employee_Row()
Sheets("All Data").Activate
row_number = 1
Do
DoEvents
row_number = row_number + 1
employee_name = ActiveSheet.Range("B" & row_number)
If InStr(employee_name, "Employee") >= 1 Then
ActiveSheet.Rows(row_number & ":" & row_number).Delete
row_number = row_number - 1
ElseIf InStr(employee_name, "Overall Total:") >= 1 Then
ActiveSheet.Rows(row_number & ":" & row_number).Delete
row_number = row_number - 1
End If
Loop Until employee_name = ""
MsgBox "Completed"
End Sub
How can I edit the code so that it also deletes the row if the cell in B is blank?
I have tried editing this line
ElseIf InStr(employee_name, "Overall Total:") >= 1 Then
to
ElseIf InStr(employee_name, "">= 1 Then
but it deletes every row on the sheet.
Thank you in advance.
Bookmarks