|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- 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
复制代码
|
|