Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

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

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

1 Answer

Relevance
  • 1 decade ago
    Favorite Answer

    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

Still have questions? Get your answers by asking now.