Re: How to blank out cells with duplicate values?

Giganews Newsgroups
Subject: Re: How to blank out cells with duplicate values?
Posted by:  Bob Phillips (bob.philli…@notheretiscali.co.uk)
Date: Tue, 2 May 2006

Some VBA

Sub test()
Dim iLastRow As Long
Dim i As Long

    iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = iLastRow To 2 Step -1
        If Application.CountIf(Columns(1), Cells(i, "A")) > 1 Then
            Cells(i, "A").Delete Shift:=xlUp
        End If
    Next i

End Sub

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Bleu_808" <bleu_8…@yahoo.com> wrote in message
news:1146523901.245202.1553…@e56g2000cwe.googlegroups.com...
> Okay - after an hour on trying to work on what I thought was an easy
> task 0 I must ask for help!
>
> My column A is a list of order numbers, each order is separated by a
> blank row...
>
> ex:
> 1234
> 1234
> 1234
> 1234
>
> 4321
> 4321
> 4321
>
> 6789
> 6789
>
> What I would like to do is delete the duplicate order numbers, without
> affecting the rest of the row.  I thought this might be a simple if
> statement, but no.  Any ideas?
>
> Thanks in advance - Bleu

Replies

In response to

How to blank out cells with duplicate values? posted by Bleu_808 on 1 May 2006