Deleting Identical Entries

S

SV

Greetings,
Fresh from my success at my first Macro (Thanks, again, Gord), I find my
users have ANOTHER request.

We generate a list of every part number and the figure on which it is
displayed. This means the list may contain a series of entries with the
same part number in the left-hand column. We've been asked to locate and
delete 'multiple entries' so the left column would have the part number only
on the first entry, and would be empty for the other rows that apply to that
part number. We can do it by hand, though it'd be tedious.

Here's what I'm trying for:

Currently: Desired

Part 1 A1 Part 1 A1
Part 1 D7 D7
Part 1 E5 E5
Part 1 G1 G1
Part 2 B3 Part 2 B3
Part 2 B6 B6
Part 2 D1 D1


I'm not sure what Macros are capable of, and maybe this is a question for
the scripting group?

Thanks,
Shane
 
B

Bob Phillips

Programming would be better, but we can help.

Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim iLastRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow To 2 Step -1
If Cells(i, TEST_COLUMN).Value = Cells(i - 1, "A").Value Then
Cells(i, TEST_COLUMN).Value = ""
End If
Next i

End With

End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
 
S

SV

Sure does, thanks!

Bob Phillips said:
Programming would be better, but we can help.

Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim iLastRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow To 2 Step -1
If Cells(i, TEST_COLUMN).Value = Cells(i - 1, "A").Value Then
Cells(i, TEST_COLUMN).Value = ""
End If
Next i

End With

End Sub

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
 
Top