RW = Array(.[R6] - 3, .[T5] - 3, .Range("R" & b.Row) - 3)
Dim R(1 To 3), L(1 To 3)
For y = 1 To 3: Set R(y) = .[J:P].Rows(RW(y - 1) + 6).Cells: Next y
For K = 1 To 7
L(1) = K
For y = 2 To 3
L(y) = Application.Match(R(1)(K), R(y), 0)
If IsError(L(y)) Then L(1) = 0: Exit For
'If L(y) <> L(1) Then L(1) = 0: Exit For '若要求〔同欄〕,加入這行
Next y
If L(1) > 0 Then
For y = 1 To 3
R(y)(L(y)).Select
Selection.Interior.ColorIndex = Array(6, 4, 8)(y - 1)
Next
End If
Next K
依與准提版主大在http://forum.twbts.com/viewthrea ... a=pageD1&page=4
的#37比對(因M變數與小弟的原檔案重複,所以在今天的提問裡~將其改為L)~
RW = Array(b(1, -1)-0, b(1, -1) - .[T3], b(1, -1) - .[T3] * 2
For y = 1 To 3: Set R(y) = .[J:P].Rows(RW(y - 1) + 6).Cells: Next y
Dim M(1 To 3)
For k = 1 To 7
M(1) = k
For y = 2 To 3
M(y) = Application.Match(R(1)(k), R(y), 0)
If IsError(M(y)) Then M(1) = 0: Exit For
'If M(y) <> M(1) Then M(1) = 0: Exit For '若要求〔同欄〕,加入這行
Next y
If M(1) > 0 Then
For y = 1 To 3: R(y)(M(y)).Interior.ColorIndex = Array(4, 45, 8)(y - 1): Next
End If
Next k
本來以為是-0或-1或-2或-3或-4或.....不會有差別
但套進小弟的使用檔中,卻只有-3跑出正確答案,其餘的答案都不符合QQ