Sub DeleteRowsNotInSheet1()
Dim ws1 As Worksheet, ws2 As Worksheet
Dim lastRow1 As Long, lastRow2 As Long
Dim i As Long, j As Long
Dim matchFound As Boolean
Set ws1 = ThisWorkbook.Worksheets("Sheet1")
Set ws2 = ThisWorkbook.Worksheets("Sheet2")
lastRow1 = ws1.Cells(ws1.Rows.Count, 1).End(xlUp).Row
lastRow2 = ws2.Cells(ws2.Rows.Count, 1).End(xlUp).Row
For i = lastRow2 To 1 Step -1
matchFound = False
For j = 1 To lastRow1
If ws2.Cells(i, 1).Value = ws1.Cells(j, 1).Value Then
matchFound = True
Exit For
End If
Next j
If Not matchFound Then ws2.Rows(i).Delete
Next i
End Sub