I'm trying to modify some existing code from another macro to do a somewhat similar task. What I want is to check the data on the status column and delete the entire row if the keyword matches. Currently my code appears to delete some of the row, but not columns A or B.
Here is what I have so far:
Data:
<tbody>
</tbody>Data table format doesn't change.
Thank you very much for any assistance you are able to provide.
Here is what I have so far:
Data:
Username | Status | Not Used | Not Used | Not Used | Time | |
SmithJohn | <<not keyword="">></not> | - | - | - | HH:MM:SS | |
SmithJohn | <<keyword>></keyword> | - | - | - | HH:MM:SS | <--- Delete this row |
SmithJohn | <<not keyword="">></not> | - | - | - | HH:MM:SS |
<tbody>
</tbody>
Code:
Sub DelRows()Dim MaxRow As Long, MyRange, agent As String, r As Long
Application.ScreenUpdating = False
MaxRow = Cells(Rows.Count, "B").End(xlUp).Row
MyRange = Range("A1:B" & MaxRow)
For r = MaxRow To 1 Step -1
If MyRange(r, 2) = "Keyword" Then Rows(r).EntireRow.Delete
Next r
Range("A1:B" & MaxRow) = MyRange
End Sub
Thank you very much for any assistance you are able to provide.