Results 1 to 4 of 4

Deleting Duplicate Row code troubleshooting

Threaded View

  1. #1
    Registered User
    Join Date
    07-23-2012
    Location
    Dayton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    20

    Deleting Duplicate Row code troubleshooting

    Hey there,

    This code will delete duplicate rows (located at C3 and on) that match cell C2 but it also deletes all rows after the last duplicate that shouldn't be deleted....what is wrong with my code?

        Dim i As Long, lastDataRow As Long
        Dim wks As Worksheet
        Dim BBB As Integer
    
        Set wks = Sheets("NCR Data")
        
        With wks
            lastDataRow = Cells(Rows.Count, "C").End(xlUp).Row
            BBB = .Cells(2, 3).Value
            For i = 3 To lastDataRow
                If BBB = .Cells(i, 3).Value Then Cells(i, 3).Select
                ActiveCell.EntireRow.Delete
            Next i
        End With
    thanks for any insight..i've tried playing around with it but no luck
    Last edited by ds16; 08-07-2012 at 04:31 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1