MS Excel how to create a macro to find duplicates and highlight them?

后端 未结 5 1295
臣服心动
臣服心动 2020-12-22 13:13

How can I create a macro in MS excel to find duplicates in a spreadsheet and highlight it

5条回答
  •  时光取名叫无心
    2020-12-22 13:34

    Sub Macro1()
    
        Dim Counter As Integer
    
        For Counter = 1 To 35
    
            'Cells.(X,Y) X = number, Y = Letter i.e D5 Cells(5,4)
            firstValue = ActiveSheet.Cells(Counter, 3)
            SecondValue = ActiveSheet.Cells(Counter, 4)
    
            If firstValue = SecondValue Then
                Rows(Counter).Interior.Color = RGB(255, 10, 10)
            End If
    
    
        Next
    
    End Sub
    

提交回复
热议问题