
展开全部
Sub xx()
n = Cells(4 ^ 8, 11).End(3).Row
col = Array(8, 7, 9, 10, 6)
For i = 11 To 33 Step 2
a = Cells(n - 11, i)
b = Cells(n - 11, i + 1)
Cells(n - 11, i).Resize(1, 2).Interior.ColorIndex = col(((i - 11) / 2) Mod 5)
For j = n - 9 To n
If Cells(j, i) <> a And Cells(j, i) <> b Then Cells(j, i).Interior.ColorIndex = 3
If Cells(j, i + 1) <> a And Cells(j, i + 1) <> b Then Cells(j, i + 1).Interior.ColorIndex = 3
Next
Next
End Sub
追问
部分填充过多了
追答
Sub xx()
n = Cells(4 ^ 8, 11).End(3).Row
col = Array(8, 7, 9, 10, 6)
For i = 11 To 33 Step 2
a = (((Cells(n - 11, i) + 1) \ 2) * 2) Mod 10
b = (a + 9) Mod 10
Cells(n - 11, i).Interior.ColorIndex = col(((i - 11) / 2) Mod 5)
If Cells(n - 11, i + 1) = a Or Cells(n - 11, i + 1) = b Then Cells(n - 11, i + 1).Interior.ColorIndex = col(((i - 11) / 2) Mod 5)
For j = n - 9 To n
If Cells(j, i) <> a And Cells(j, i) <> b Then Cells(j, i).Interior.ColorIndex = 3
If Cells(j, i + 1) <> a And Cells(j, i + 1) <> b Then Cells(j, i + 1).Interior.ColorIndex = 3
Next
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询