Remove duplicates didn't seem to work so well.
I need something that will, for every duplicate value in column A, remove one of the rows associated with it. Does not matter which one.
Remove duplicates didn't seem to work so well.
I need something that will, for every duplicate value in column A, remove one of the rows associated with it. Does not matter which one.
Try running this Macro.
Sub Macro2()
LR = Selection.SpecialCells(xlCellTypeLastCell).Row
LC = Selection.SpecialCells(xlCellTypeLastCell).Column + 1
ActiveSheet.Sort.SortFields.Add Key:=Range("A1:A" & LR) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A1:A" & LR)
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range(Cells(1, LC), Cells(LR, LC)).FormulaR1C1 = "=IF(RC[" & 1 - LC & "]=R[1]C[" & 1 - LC & "],1,"""")"
Range(Cells(1, LC), Cells(LR, LC)).Value = Range(Cells(1, LC), Cells(LR, LC)).Value
Range(Cells(1, LC), Cells(LR, LC)).SpecialCells(xlCellTypeConstants, 1).Select
Selection.EntireRow.Delete
Columns(LR & ":" & LR).delete
Range("A1").select
End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks