VBA Excel: Remove duplicates with 2 criteria
Clairette
-
Clairette -
Clairette -
Hello,
I'm looking to remove duplicate rows in my list based on two criteria. But I'm really stuck. I'm completely lost here... if someone could help me please!!!
I had gotten to this point:
x.Range("B2:C2").Select
donnee1 = x.Range("B2:C2")
ActiveCell.Offset(1, 0).Select
While ActiveCell <> ""
If ActiveCell = donnee1 Then
ActiveCells.EntireRow.Delete
ActiveCells.Offset(-1, 0).Select
donnee1 = ActiveCell
ActiveCells.Offset(1, 0).Select
Else
donnee1 = ActiveCells
ActiveCells.Offset(1, 0).Select
End If
Wend
I thank those who will at least take a look!!!
Configuration: Windows XP / Internet Explorer 6.0
I'm looking to remove duplicate rows in my list based on two criteria. But I'm really stuck. I'm completely lost here... if someone could help me please!!!
I had gotten to this point:
x.Range("B2:C2").Select
donnee1 = x.Range("B2:C2")
ActiveCell.Offset(1, 0).Select
While ActiveCell <> ""
If ActiveCell = donnee1 Then
ActiveCells.EntireRow.Delete
ActiveCells.Offset(-1, 0).Select
donnee1 = ActiveCell
ActiveCells.Offset(1, 0).Select
Else
donnee1 = ActiveCells
ActiveCells.Offset(1, 0).Select
End If
Wend
I thank those who will at least take a look!!!
Configuration: Windows XP / Internet Explorer 6.0
4 answers
-
-
-
Hello,
in the Excel 2007/2010 version, you can go to the Data tab, "Data Tools", "Remove Duplicates" tool. For other versions, it should be possible but I don't know how to access it.
Best regards.
--
This guy was not very bright, as he was foolish. -
If only someone could explain to me why this code:
Dim y As Worksheet
Set y = Workbooks("Fichier Commun.xls").Sheets("Factures mobilisées")
Sheets("Factures mobilisées").Activate
y.Range("A1:Z10000").Sort Key1:=Range("P1"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
works very well if I put it in a command button on the sheet but does not work at all if I put it in a command button on another sheet or in a beforeclose procedure or in a button placed in another file?
The Sort method of the Range class fails... that is what prevents me from continuing... does anyone have an answer???