Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub CommandButton1_Click()
- 'Code to select data
- Worksheets("Remove Duplicates").Cells.Select For sorting data
- With ActiveWorkbook.Worksheets("Remove Duplicates").Sort
- SetRange Range("8:8") Header = xlYes
- MatchCase = False
- Orientation = x/TopToBottom
- Apply End With
- lastrow = Worksheets("Remove Duplicates").Cells(Rows.Count, 2).End(xlUp).Row
- For i = lastrow To 2 Sep by-1
- If Worksheets("Remove Duplicates").Cells(i, 2).Value = Worksheets("Remove Duplicates").Cells(i-1, 2).Value Then Worksheets("Remove Duplicates").Rows(1).Select Selection.Delete shift:=xlUp
- End If
- Next
- Worksheets("Remove Duplicates").Cells(1, 1).Select
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement