Excel delete duplicate rows
Closed
bob foster
-
7 Jun 2010 à 23:33
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 8 Jun 2010 à 05:20
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 8 Jun 2010 à 05:20
Related:
- Excel delete duplicate rows
- Delete duplicates in excel - Guide
- Excel mod apk for pc - Download - Spreadsheets
- How to duplicate data from one excel sheet to another - Guide
- How to delete a row in word - Guide
- Repeat rows in excel - Guide
1 response
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
8 Jun 2010 à 05:20
8 Jun 2010 à 05:20
Sub DeleteDuplicate()
Dim iMaxCols As Integer
Dim lMaxRows As Long
Dim Cell As Range
ActiveSheet.AutoFilterMode = False
Set Cell = Cells.Find("*", Cells(1, "A"), SearchOrder:=xlByColumns, SearchDirection:=xlPrevious)
If Cell Is Nothing Then Exit Sub
iMaxCols = Cell.Column + 1
Set Cell = Cells.Find("*", Cells(1, 1), SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
lMaxRows = Cell.Row
With Range(Cells(1, iMaxCols), Cells(lMaxRows, iMaxCols))
.FormulaR1C1 = "= RC1 & ""|"" & RC2 & ""|"" & RC3"
.Copy
.PasteSpecial xlPasteValues
End With
With Range(Cells(1, iMaxCols + 1), Cells(lMaxRows, iMaxCols + 1))
.FormulaR1C1 = "=COUNTIF( R1C[-1] : RC[-1],""="" & RC[-1])"
.Copy
.PasteSpecial xlPasteValues
End With
Cells.Select
Selection.AutoFilter
Cells.AutoFilter Field:=iMaxCols + 1, Criteria1:=">1"
Rows("2:" & lMaxRows).Delete
ActiveSheet.AutoFilterMode = False
Columns(iMaxCols).Delete
Columns(iMaxCols).Delete
Set Cell = noting
End Sub