Consulting

Results 1 to 6 of 6

Thread: Removing Duplicate Entries in a Column

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Removing Duplicate Entries in a Column

    I have a worksheet with some 13,000 entries in column C. I would like my code to look down the column and delete the line above if the text value is the same. I wrote the following but found Excel 97 would simply crash.

    On Error Resume Next
    Dim cell As Range
    Dim wks As Worksheet
    Set wks = ThisWorkbook.Worksheets("Sheet1")
    Set cell = wks.Range("c2") ' start at the second item
    Do While cell.Value <> ""
        If cell.Value <> cell.Offset(-1, 0).Value Then
            cell.EntireRow.Delete ' Delete row
        End If
        Set cell = cell.Offset(1, 0)
    Loop
    Any suggestions before I go nuts??
    Last edited by Aussiebear; 04-29-2023 at 09:38 PM. Reason: Adjusted the code tags

Posting Permissions

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