|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub run()
- For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row
- If Cells(i, 2) = Cells(i + 1, 2) Or Cells(i + 1, 2) = "" Then
- ‘把 and 列的条件去掉 就可以实现你的逻辑
- If Cells(i, 3) = Cells(i + 1, 3) And Cells(i, 4) = Cells(i + 1, 4) And Cells(i, 5) = Cells(i + 1, 5) And Cells(i, 6) = Cells(i + 1, 6) Then
- strn = "A" & Trim(Str(i)) & ":I" & Trim(Str(i))
- Range(strn).Select
- Selection.Interior.ColorIndex = 6
- strn = "A" & Trim(Str(i + 1)) & ":I" & Trim(Str(i + 1))
- Range(strn).Select
- Selection.Interior.ColorIndex = 6
- End If
- End If
- Next i
- End Sub
复制代码
|
|