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

ABCDE
654321654321678900678900678900
765432876543765432876543

<TBODY>
</TBODY>

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

<TBODY>
</TBODY>
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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,215,409
Messages
6,124,730
Members
449,185
Latest member
ekrause77

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