Excel Highlight Duplicates and Filter by color alternative

后端 未结 3 2035
遇见更好的自我
遇见更好的自我 2020-12-21 07:29

My spreadsheet has about 800,000 rows with 30 columns. Customers are interested in duplicate values only in one column. They need the entire row back. For e.g.



        
3条回答
  •  渐次进展
    2020-12-21 08:10

    Screenshot 1

    Try this Vba-code (and learn a little bit Dutch)

    Sub DuplicatesInColumn()
    'maakt een lijst met de aangetroffen dubbelingen
    Dim LaatsteRij As Long
    Dim MatchNr As Long
    Dim iRij, iKolom, iTeller, Teller As Long, ControlKolom As Long
    iRij = 1
    
    iKolom = 5                   'number of columns in the sheet, Chance if not correct
    ControlKolom = 4             'column number where to find the doubles, Chance if not correct
    
    LaatsteRij = Cells(65000, iKolom).End(xlUp).Row: iTeller = iKolom
    
    Sheet1.Activate
    For iRij = 1 To LaatsteRij
        If Cells(iRij, ControlKolom) <> "" Then
            MatchNr = WorksheetFunction.Match(Cells(iRij, ControlKolom), Range(Cells(1, ControlKolom), Cells(LaatsteRij, ControlKolom)), 0)
        If iRij <> MatchNr Then
        iTeller = iKolom
        For Teller = 1 To iTeller
          Cells(iRij, iKolom + Teller).Offset(0, 2).Value = Range(Cells(iRij, Teller), Cells(iRij, Teller)).Value
        Next Teller
        End If: End If
    Next
    End Sub
    

提交回复
热议问题