Try this code
Copy the Excel VBA code![]()
Sub delete_dups() Dim i As Long, lrow As Long Application.ScreenUpdating = False With Worksheets("Sheet1") .Cells.Sort Key1:=.Range("A2"), Order1:=xlAscending, Key2:=.Range("B2") _ , Order2:=xlAscending, key3:=.Range("G2"), order3:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:= _ False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:=xlSortNormal lrow = .Range("A" & .Rows.Count).End(xlUp).Row For i = lrow To 2 Step -1 If .Range("A" & i).Value = .Range("A" & i - 1).Value And .Range("B" & i).Value = .Range("B" & i - 1).Value And _ .Range("G" & i).Value = .Range("G" & i - 1).Value Then .Rows(i).Delete End If Next i End With Application.ScreenUpdating = True End Sub
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 Tools | Macro | Macros
Select a macro in the list, and click the Run button











LinkBack URL
About LinkBacks
Register To Reply
Bookmarks