View Single Post
  #9   Report Post  
JMB
 
Posts: n/a
Default

from reading your other post, it sounds like you have one column of names
(which are duplicated), but the data adjacent to the name may not be
duplicated and you want to move the data adjacent to the name before deleting
it. I thought you just wanted to delete the duplicate items - obviously you
will not want to use my previous suggestion (not right away, anyway).

Would your data look like the following?

Name Address Email phone
Jim Moore xxx
Nancy Smith yyy
Jim Moore zzz
Jim Moore aaa

Since Jim is duplicated, you'd want to move his data up to the first line -
then delete the duplicates.



"JMB" wrote:

You could copy the following macro into a module in VBA, select the
row/column you want and run the macro. Be advised, it will delete the entire
row or column that contains the duplicate data, so if you have data
above/below your table you'll want to move it to a blank sheet, remove dupes,
then move it back. Also, cannot undo, always a good idea to have a backup.


Sub DeleteDuplicates()
Dim Collection1 As New Collection
Dim Range1 As Range
Dim Direction As Byte

On Error Resume Next

With Selection
If .Rows.Count 1 And _
.Columns.Count = 1 Then
Direction = 1
ElseIf .Columns.Count 1 And _
.Rows.Count = 1 Then
Direction = 2
Else: Exit Sub
End If
End With

For Each x In Selection
Collection1.Add x.Value, CStr(x.Value)
If Err < 0 Then
Err.Clear
If Range1 Is Nothing Then
Set Range1 = x
Else: Set Range1 = Union(Range1, x)
End If
End If
Next x

Select Case Direction
Case 1: Range1.EntireRow.Delete
Case 2: Range1.EntireColumn.Delete
Case Else: Exit Sub
End Select

End Sub


"joe peters" wrote:


I have 9,900 entries, with around 1,800 duplicate names. I really have
no desire to go through them on an individual basis.



Ola Wrote:
Try
="hello "&" tello"&" bello"
or
=A1&B1



--
joe peters