VBA核对数据


Option Explicit

Sub 分机床产量()

Dim rng As Range, rng1 As Range

For Each rng In Worksheets("产量表").Range("c2:c85")

For Each rng1 In Range("c2:c81")

If rng1.Value = rng.Value Then

 If Application.WorksheetFunction.CountIf(Range("c2:c81"), rng.Value) = 1 Then

 rng1.Offset(0, 4).Resize(1, 3).Value = rng.Offset(0, 2).Resize(1, 3).Value

 rng1.Interior.ColorIndex = 6

 rng.Interior.ColorIndex = 6

 End If

End If

Next

Next

End Sub

你可能感兴趣的:(VBA核对数据)