• Removing Duplicate Rows (Excel 97) (Excel 97)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Removing Duplicate Rows (Excel 97) (Excel 97)

    Author
    Topic
    #378889

    To any one who can help. I have a file that has several hundred rows of data. Some of the rows contain exactly the same information across all columns. I need a way to scan the rows and automatically delete the duplicate rows.

    Any help is greatly appreciated.

    Thanks Brad

    Viewing 2 reply threads
    Author
    Replies
    • #628856

      Advanced filter
      Copy unique records to another location or do it in place

      Steve

    • #628872

      The VBA code below will delete all duplicate rows on the active worksheet:

      Public Sub DelDupRows()
      Dim I As Long, J As Long, K As Long
      Dim lRMax As Long, lCMax As Long
          With ActiveSheet
              lRMax = .UsedRange.Row + .UsedRange.Rows.Count - 2
              lCMax = .UsedRange.Column + .UsedRange.Columns.Count - 2
              For I = lRMax To 1 Step -1
                  For J = I - 1 To 0 Step -1
                      For K = 0 To lCMax
                          If .Range("A1").Offset(I, K).Value  .Range("A1").Offset(J, K).Value Then Exit For
                      Next K
                      If K > lCMax Then
                          .Range("A1").Offset(I, K).EntireRow.Delete
                      End If
                      Exit For
                  Next J
              Next I
          End With
      End Sub
      
    • #629051

      To all that replied. Thanks! The macro did the job.

      Brad

    Viewing 2 reply threads
    Reply To: Removing Duplicate Rows (Excel 97) (Excel 97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: