PDA

View Full Version : Solved: Help Removing Duplicates



markmrw
11-13-2008, 09:05 AM
Good morrow

i need some help with my code (attached)

i have a module that removes duplicate values then does some other gumphf!

But what i would like is for the macro not to just remove the duplicate values, but also the original values.

For example

123 ' i would like this deleted
125
124
123 ' and this

thank you this has caused me much brain already.

Mark
10727

lucas
11-13-2008, 09:13 AM
Some of us don't have 2007 so we can't look at your file. Is this in the sheet or a combobox in a userform, etc.

Can you post the code?

markmrw
11-13-2008, 09:22 AM
i will do it better

have a compatible version

Mark

10728

lucas
11-13-2008, 09:31 AM
So, are the duplicates on sheet Totals Pallet (8) and are they the box number?

georgiboy
11-13-2008, 09:32 AM
Try this

Sub RemoveDuplicates()
Dim rCell As Range

For Each rCell In Range("A2:A70").Cells

If WorksheetFunction.CountIf(Range("A:A"), rCell.Value) > 1 Then
Range("A:A").Replace What:=rCell.Value, Replacement:=""
End If

Next rCell

End Sub

Hope this helps

georgiboy
11-13-2008, 09:50 AM
Like this

markmrw
11-14-2008, 05:12 AM
Thats fantastic
thank you ver much i will post the final code when i get it up and running thank you very much

Mark