Try this code
Option Explicit
Sub delete_rows()
Dim i As Long, j As Long, lrow As Long
Application.ScreenUpdating = False
If Worksheets("Sheet2").Range("A1") = "" Then Worksheets("Sheet1").Rows(1).Copy Worksheets("Sheet2").Range("A1")
With Worksheets("Sheet1")
lrow = .Range("A" & .Rows.Count).End(xlUp).Row
For i = lrow To 2 Step -1
For j = 17 To 18
If .Cells(i, j).Value Like "*termination*" Or .Cells(i, j).Value Like "*terminated*" Or .Cells(i, j).Value Like "*resigned*" _
Or .Cells(i, j).Value Like "*resign*" Or .Cells(i, j).Value Like "*redundant*" Or .Cells(i, j).Value Like "*released*" _
Or .Cells(i, j).Value Like "*cancel enrollment*" Then
.Rows(i).Copy Worksheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Application.CutCopyMode = False
.Rows(i).Delete
End If
Next j
Next i
End With
Application.ScreenUpdating = True
End Sub
Copy the Excel VBA code
Select the workbook in which you want to store the Excel VBA code
Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
Choose Insert | Module
Where the cursor is flashing, choose Edit | Paste
To run the Excel VBA code:
Choose View | Macros
Select a macro in the list, and click the Run button
Bookmarks