|
こんばんは。
同じAAAやBBBでも全然関係なかったのね?!???
初心者の私には、無理だと思います。
ウッシさんのを参考にしてください。
私にできるのは、ここまで。
Sub test3()
Dim myCol As Single, myCol2 As Single
Dim myRng As Range, myRng2 As Range
Dim r As Range, c As Range
With Worksheets("sheet1")
Set myRng2 = .Range("A1", Range("A1").End(xlToRight))
For Each c In myRng2
If c.Value = "項目1" Then
myCol = c.Column
ElseIf c.Value = "項目2" Then
myCol2 = c.Column
End If
Next
Set myRng = .Range(Cells(1, myCol), .Cells(65536, myCol).End(xlUp))
For Each r In myRng
Select Case r.Value
Case Is = "AAA" '照合1
If .Cells(r.Row, myCol2).Value = "BBB" Then
.Cells(r.Row, myCol2).Interior.ColorIndex = 3
End If
Case Is = "AAA" '照合2
If .Cells(r.Row, myCol2).Value = "BBB" Or _
.Cells(r.Row, myCol2).Value = "CCC" Then
.Cells(r.Row, myCol2).Interior.ColorIndex = 3
End If
Case Is = "AAA", "BBB" '照合3
If .Cells(r.Row, myCol2).Value = "CCC" Then
.Cells(r.Row, myCol2).Interior.ColorIndex = 3
End If
End Select
Next
End With
End Sub
|
|