ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   delet multiple entries on same row(different columns) (https://www.excelbanter.com/excel-discussion-misc-queries/219910-delet-multiple-entries-same-row-different-columns.html)

clcnewtoaccess

delet multiple entries on same row(different columns)
 
my data has duplicates in some rows that I need to get rid of, below is an
example.
look at the first row below in my example, it needs to be as follows:
057330 0257015 0257020 0257065

Example:
0573300 0257015 0257015 0257020 0257020 0257065 0257065
0573300 0257015 0257020 0257065 0257070 0257099 0280346
0573300 0257015 0257020 0257065 0257070 0257099 0280346
0573001 0573001 0573001 0271596 0271539 0271539 0273410
0573300 0257020 0257065 0257015 0257070 0257099 0280346
0573300 0573300 0257020 0272950 0271518 0279710 0642718


--
clcnewtoaccess

Chip Pearson

delet multiple entries on same row(different columns)
 

Try some code like the following

Sub AAA()

Dim CNdx As Long
Dim RNdx As Long
Dim WS As Worksheet

Set WS = ActiveSheet
RNdx = 1 '<< CHANGE TO START ROW
With WS
Do Until .Cells(RNdx, 1).Value = vbNullString
CNdx = .Cells(RNdx, .Columns.Count).End(xlToLeft).Column
Do Until CNdx = 1
If Application.CountIf(.Cells(RNdx, 1).Resize(1, CNdx), _
.Cells(RNdx, CNdx)) 1 Then
.Cells(RNdx, CNdx).Delete shift:=xlToLeft
End If
CNdx = CNdx - 1
Loop
RNdx = RNdx + 1
Loop
End With
End Sub


Change RNdx = 1 to the appropriate starting row number. The code will
process each row, deleting duplicates, until a blank cell is
encountered in column A.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Mon, 9 Feb 2009 11:49:01 -0800, clcnewtoaccess
wrote:

my data has duplicates in some rows that I need to get rid of, below is an
example.
look at the first row below in my example, it needs to be as follows:
057330 0257015 0257020 0257065

Example:
0573300 0257015 0257015 0257020 0257020 0257065 0257065
0573300 0257015 0257020 0257065 0257070 0257099 0280346
0573300 0257015 0257020 0257065 0257070 0257099 0280346
0573001 0573001 0573001 0271596 0271539 0271539 0273410
0573300 0257020 0257065 0257015 0257070 0257099 0280346
0573300 0573300 0257020 0272950 0271518 0279710 0642718



All times are GMT +1. The time now is 01:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com