|
時間がありましたので、作ってみました
Sub 色分け()
Dim GYO As Integer, X As Integer
'この部分はセルの値を並列に入れたほうが簡単
Dim A5(6) As String
A5(1) = "123ACB"
A5(2) = "234ACB"
A5(3) = "345ACB"
A5(4) = "456ACB"
A5(5) = "789ACB"
A5(6) = "13ACB"
For GYO = 2 To 15
For X = 1 To 6
If Cells(GYO, 5) = A5(X) Then'A5(1,X)
Cells(GYO, 1).Resize(1, 30).Interior.ColorIndex = X'A5(2,X)
Exit For
End If
Next X
Next GYO
End Sub
'別の方法 セルの値を並列に入れた(判定させる値を変更には便利)
A1〜F1に"123ACB"などA2〜F2に色番号を入れます。
Dim A5 As Variant
A5 = Cells(1, 1).Resize(2, 6).Value
For GYO = 2 To 15
For X = 1 To 6
If Cells(GYO, 5) = A5(1,X) Then
Cells(GYO, 1).Resize(1, 30).Interior.ColorIndex = A5(2,X)
Exit For
End If
Next X
Next GYO
End Sub
|
|