Duplicating cells from a column

Amiles

New Member
Joined
May 26, 2010
Messages
9
Hi,

I have looked on this site and have found a lot of posts for duplicating cells when you have dupliactes in a row but not when your trying to duplicate from a column, attached is an example of what I mean

[TABLE="width: 500"]
<TBODY>[TR]
[TD][TABLE="width: 500"]
<TBODY>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]654321[/TD]
[TD]654321[/TD]
[TD]678900[/TD]
[TD]678900[/TD]
[TD]678900[/TD]
[/TR]
[TR]
[TD]765432[/TD]
[TD]876543[/TD]
[TD]765432[/TD]
[TD]876543[/TD]
[TD][/TD]
[/TR]
</TBODY>[/TABLE]
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
What I want to do is delete the duplicates out, however its not a simple as other examples as you might have numbers inbetween column A and some are longer duplicates of the numbers than others
[/TD]
[TD][/TD]
[/TR]
</TBODY>[/TABLE]
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
So which option do you want?
1) clear the contents of the cell
2) delete the cell and move the remaining cells to the left
 
Upvote 0
try this

Code:
Sub DeleteDuplicates()
Dim LR As Long
Dim LC As Long
LR = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LR
LC = ActiveSheet.Cells(i, "IV").End(xlToLeft).Column
    For j = LC To 1 Step -1
    RCnt = WorksheetFunction.CountIf(Rows(i), Cells(i, j))
        If RCnt > 1 Then
            Cells(i, j).Delete Shift:=xlToLeft
        End If
    Next j
Next i
MsgBox "Done"
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,119
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top