I need to sort and delete dupes in a list of page number citations,
all existing in one cell:
1, 1, 3, 5, 7, 9, 2, 2, 4, 6, 8
Needs to appear as
1, 2, 3, 4, 5, 6, 7, 8
In one cell
Please advise if this would be better accomplished in Excel, or VB.
Thanks!
Al
Set drange = Selection.Cells(1).Range
drange.End = drange.End - 1
Dim m As Variant
Dim i As Long
Dim result As String
result = ""
m = Split(drange, ",")
For i = LBound(m) + 1 To UBound(m)
If InStr(result, m(i)) = 0 Then
result = result & "," & m(i)
End If
Next i
result = Mid(result, 2)
drange.Text = Replace(result, ",", vbCr)
drange.Sort
Set drange = Selection.Cells(1).Range
drange.End = drange.End - 1
drange.Text = Mid(Replace(drange.Text, vbCr, ","), 2)
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
<alfred....@gmail.com> wrote in message
news:59076802-dd5e-4bdc...@u18g2000pro.googlegroups.com...
I haven't had a chance to test this, but thank you very much for your
time!
Al