|
大分類&中&小がSheets(1)に合って、Sheets(2)に無い場合で善いなら
但し、大分類&中&小でユニーク(一意)である事
Sub test_2()
Dim i As Long, k As Long
Dim RowEnd1 As Long
Dim RowEnd2 As Long
Dim Ws1 As Worksheet
Dim Ws2 As Worksheet
Set Ws1 = Sheets(1)
RowEnd1 = Ws1.Cells(Rows.Count, 1).End(xlUp).Row
Set Ws2 = Sheets(2)
RowEnd2 = Ws2.Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To RowEnd1
For k = 2 To RowEnd2
If Ws1.Cells(i, 1).Value = Ws2.Cells(k, 1).Value Then
If Ws1.Cells(i, 2).Value = Ws2.Cells(k, 2).Value Then
If Ws1.Cells(i, 3).Value = Ws2.Cells(k, 3).Value Then
Exit For
End If
End If
End If
Next k
'Sheets(2)のListに無い場合
If k > RowEnd2 Then
Ws1.Cells(i, 1).Interior.ColorIndex = 3
End If
Next i
Set Ws1 = Nothing
Set Ws2 = Nothing
End Sub
|
|