Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Sep 2001
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete Double Cells (Excel 97)

    Hello,

    I hope someone can help me with this. Can I write a macro so that I can delete all the rows that have the same data in a specific column?

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete Double Cells (Excel 97)

    This code will delete all of the rows in that have duplicates in column A.

    <pre>Public Sub DelDups()
    Dim I As Long, J As Long, lMax As Long
    lMax = Worksheets("Sheet1").Range("A1").Offset(Worksheets ("Sheet1").UsedRange.Rows.Count, 0).End(xlUp).Row - 1
    For I = lMax To 1 Step -1
    For J = I - 1 To 0 Step -1
    If Worksheets("Sheet1").Range("A1").Offset(I, 0).Value = Worksheets("Sheet1").Range("A1").Offset(J, 0).Value Then
    Worksheets("Sheet1").Range("A1").Offset(J, 0).EntireRow.Delete
    End If
    Next J
    Next I
    End Sub
    </pre>

    Legare Coleman

  3. #3
    Lounger
    Join Date
    Sep 2001
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete Double Cells (Excel 97)

    Thanks for you help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •