I am hoping this is a relatively straightforward question, but this is still a little over my head.
I have written the code below to Delete duplicate rows based on ID in Column A
Code: Select all
Sub Delete_Shift()
Dim i As Long
Set MySheet = Sheets("Sheet1")
With MySheet
Last = .Cells(Rows.Count, "A").End(xlUp).Row + 1
Application.ScreenUpdating = False
For i = .Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
If WorksheetFunction.CountIf(.Range("A2:A" & i), .Range("A" & i).Value) > 1 Then
.Rows(i & ":" & i).Delete Shift:=xlUp
End If
Next i
Application.ScreenUpdating = True
End With
End Sub
How can update the code to run faster.
Please consider checking out my work. Thanks in advance for any assistance.!