先在此感謝各位閱讀與幫忙
新增條件:
1.A3儲存格手動輸入日期
2.第四列依照A3儲存格日期,改變第五列至第十四列顏色
之前已完成條件,請參考連結:
1.A1到C1為變數,黃色
2.A2到C2為變數,綠色
3.數字變色限制在E5到E14之間
感謝rogeryao回覆解答
https://ithelp.ithome.com.tw/questions/10202206
Private Sub CommandButton1_Click()
Dim u as Integer
u=0
For x= 3 To 5
If (Cells(3, 1) = Cells(4, x)) Then
u=x
End If
Next x
If u>0 Then
For i = 5 To 14
For k = 1 To Range("A1").End(xlToRight).Column
If (Cells(i, u) = Cells(1, k)) Then
Cells(i, u).Interior.ColorIndex = 6
ElseIf (Cells(i, u) = Cells(2, k)) Then
Cells(i, u).Interior.ColorIndex = 4
End If
Next k
Next i
End If
End Sub