January 18, 2009

Do you have a good MS Word macro to remove duplicate lines from a sorted list?

Todd E. Tornow asked:


Do you have a good MS Word for Windows macro to remove duplicate lines from a sorted list?

Filed under Programming & Design by Administrator

Permalink Print

Comments on Do you have a good MS Word macro to remove duplicate lines from a sorted list?

January 18, 2009

Feaelin @ 5:35 pm

Depending on how your sorted list is arranged, this may work.

Sub RemoveRepeats()
    ’
    ’ RemoveRepeats Macro
    A = 1
    Do While A < Selection.Words.Count
        If Selection.Words(A) = Selection.Words(A + 1) Then
            Selection.Words(A).Cut
            A = A - 1
        End If
        A = A + 1
    Loop
End Sub