|
>後、上記の式で Case "い"
> myColorl = 6 '黄
>だけ色が付かないのですが、どうしてでしょうか?
myColor = 6 '黄
別な方法で
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Long
Dim vntItem As Variant
Dim vntColor As Variant
Dim vntValue As Variant
With Target
If .Count <> 1 Then Exit Sub
If Not (.Column = 3 Or .Column = 6 Or .Column = 9) Then Exit Sub
vntValue = .Value
End With
'"白","あ","い","う","え","お"
vntItem = Array("白", "あ", "い", "う", "え", "お")
'"赤"、"青"、"黄"、"グレー"、"緑"、"茶"、"無し"
vntColor = Array(3, 5, 6, 15, 43, 30, xlNone)
For i = 0 To UBound(vntItem)
If vntValue = vntItem(i) Then
Exit For
End If
Next i
Target.Interior.ColorIndex = vntColor(i)
End Sub
|
|