Removing double lines by macro in excel 97

B

Bit3m3

Hello,

I'm using excel 97 and I want to save paper with my prints...so I need
your help :)
I'm importing into excel a couple of lines (this may vary day by day.)
there I copy by a simple macro a vertical lookup function an action I
have to perform by each rule.
due to some technical issue I receive double and triple lines (even
four lines if I'm lucky).
I have to print this report so it would be nice if a macro could
automaticly remove lines untill a line is unique.

so by example.
A B C D E
1 28-12-2006 51803 6511927 Nogueira & Barroco Lda Faxen
2 28-12-2006 51803 6511927 Nogueira & Barroco Lda Faxen
3 28-12-2006 51803 6511927 Nogueira & Barroco Lda Faxen

They are always grouped but I want to remove (not hide) the 2 or three
lines
In one sheet a hundred ore more lines are like this

Could any one help?
If I'm not clear please also tell me and I'll try to clear things.

Thnx Jerry
 
P

Pete

If the text for one line is in one cell (A2 A3 A4 etc) then you could do
this easily using Advance Filter
Place the first piece of data in A2 headed by some heading eg Data (with
bold/italics etc to give it header 'status') :

Data
28-12-2006 51803 6511927 Nogueira & Barroco Lda Faxen
28-12-2006 51803 6511927 Nogueira & Barroco Lda Faxen
28-12-2006 51803 6511927 Nogueira & Barroco Lda Faxen


Now run this macro:
Sub FilterOutDuplicates()
Range("A1", Range("A65536").End(xlUp)).AdvancedFilter
Action:=xlFilterCopy, CopyToRange:=Range("B1"), Unique:=True
Range("A1", Range("A65536").End(xlUp)).ClearContents
Range("B1", Range("B65536").End(xlUp)).Cut Range("A1")
End Sub
 
B

Bit3m3

Thank you very much !

Jerry

JLGWhiz schreef:
I took a second look at the code and decided it needed a fix. Here is the
one that works right.

Sub DelDupRow()
LR = Cells(Rows.Count, 1).End(xlUp).Row
Range("$A$1").Activate
Do
For i = 1 To LR
x = ActiveCell.Address
If Range(x).Value = Range(x).Offset(1, 0).Value And Range(x).Offset(0,
1).Value = Range(x).Offset(1, 1).Value And Range(x).Offset(0, 2).Value =
Range(x).Offset(1, 2).Value Then
Range(x).Offset(1, 0).EntireRow.Delete
End If
Next i
Range(x).Offset(1, 0).Activate
Loop Until Range(x) = ""
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top