PDA

View Full Version : Solved: deleting duplicate rows



Anomandaris
10-28-2009, 05:12 AM
HI,

I'm trying to delete duplicate rows, is there a macro to do that?
My Data consists of figures in Columns A and B


thanks

GTO
10-28-2009, 05:36 AM
Greetings Anomandaris,

By "figures," do you mean some type of data, where if such data matches in the same row (in columns A and B), then delete the row?

Mark

MaximS
10-28-2009, 06:44 AM
try that Anomandaris:


Sub Duplicate_Delete()

Dim i As Integer, x As Long, LR As Long

'Change range as required
LR = Range("A" & Rows.Count).End(xlUp).Row

For i = LR To 1 Step -1
'Change range as required
x = WorksheetFunction.CountIf(Range("A1:A" & LR), Range("A" & i).Value)
If x > 1 Then
Rows(i).Delete
End If
Next i

End Sub

Anomandaris
10-28-2009, 10:44 AM
thanks Maxim

that works great!