JZB
04-15-2009, 05:44 AM
Hi
I am creating a loop that deletes any duplicates. so the logic is to put the data into ascending order then delete an entry if it equals the preceeding:
nlastrow = Range("A65536").End(xlUp).Row
Range("A2").Select
For nloop = 1 To nlastrow
If InStr(ActiveCell, ActiveCell.Offset(-1, 0)) = 1 Then
ActiveCell.EntireRow.Delete
Else: ActiveCell.Offset(1, 0).Select
End If
Next nloop
the problem: the loop i have created is deleting not only identical refs but those with similarities. e.g. row1 has DPC1, row 2 has DPC2. however the current loop is deleting DPC2. :banghead:
the instr statement needs to be modified, i thought = 1 meant they had to be identical but i must be wrong.
can someone advise?
I am creating a loop that deletes any duplicates. so the logic is to put the data into ascending order then delete an entry if it equals the preceeding:
nlastrow = Range("A65536").End(xlUp).Row
Range("A2").Select
For nloop = 1 To nlastrow
If InStr(ActiveCell, ActiveCell.Offset(-1, 0)) = 1 Then
ActiveCell.EntireRow.Delete
Else: ActiveCell.Offset(1, 0).Select
End If
Next nloop
the problem: the loop i have created is deleting not only identical refs but those with similarities. e.g. row1 has DPC1, row 2 has DPC2. however the current loop is deleting DPC2. :banghead:
the instr statement needs to be modified, i thought = 1 meant they had to be identical but i must be wrong.
can someone advise?