- Sub xiugai()
- Dim i, x, y As Integer
- Dim a, b
- With Sheets("sheet1")
- x = 2
- For i = 3 To .[j65536].End(xlUp).Row
- If .Cells(i, "j").Value = .Cells(i, "k").Value And .Cells(i, "j") <> "" Then
- x = x + 1
- .Range(.Cells(i, "j"), .Cells(i, "k")).Font.Color = -16776961
- a = .Cells(x, "j")
- b = .Cells(x, "k")
- .Range(.Cells(i, "j"), .Cells(i, "k")).Copy (.Range(.Cells(x, "j"), .Cells(x, "k")))
- If i <> 3 Then
- .Range(.Cells(i, "j"), .Cells(i, "k")).Font.Color = xlThemeColorLight1
- End If
- .Cells(i, "j") = a
- .Cells(i, "k") = b
- End If
- Next
- End With
- End Sub
复制代码 |