View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default delete rows that have a duplicate id keeping the upper row

Sub DelDupRow() 'if duplicates exists, deletes duplicate rows
Dim lr As Long, sh As Worksheet
Set sh = ActiveSheet
lr = sh.Cells(Rows.Count, 1).End(xlUp).Row .
For i = lr To 2 Step -1
With sh
If Cells(i, 1).Value = Cells(i-1, 1).Value Then
Rows(i).Delete
End If
End With
Next
End Sub






"Bruce Walker" <Bruce wrote in message
...
I neeed a macro that will delte a row based on a duplicate value in column
A;
Row col A col B col C
Claim Number DCC Warranty Code
1 0132482B DTYC 03D
2 0137448A 1
3 0141614A 01D
4 0141614A
5 0141614A
6 0143504B 1
7 0154120A DW77 01D
8 0154120A
9 0159953A DWL0 03D
In this example I want to delete rows 4,5, and 8 How might this be
accomlpished? Thanks.
Bruce