For i = 1 To UBound(Arr) - 1
'↑設定迴圈將Arr這些被搜尋的日期範圍與J.K欄關鍵字組成字串當KEY
'倒入xD陣列中,ITEM設為6(ITEM設>0的數字就可以!因為ITEM沒有用到)
Ts = Arr(i, 1)
Tn = Arr(i + 1, 1)
T1 = Arr(i, 2)
T2 = Arr(i, 3)
T = Tn - Ts
For x = 0 To T
xD(Ts + x & T1) = 6
xD(Ts + x & T2) = 6
Next
Next
For Each Ra In xA
'↑設定迴圈將xA裡的儲存格組成字串,
'(YYYY/M/D&Weekday)之後
'到xD字典裡查看看是否查得到,
'如果有就把儲存格放入Rng儲存格集裡
Ct = Ra & Format(Ra, "dddd")
If xD(Ct) Then
If Rng Is Nothing Then
Set Rng = Ra
Else
Set Rng = Union(Rng, Ra)
End If
End If
Next
Rng.Interior.ColorIndex = 38
'↑最後把儲存格集的底色變更為想要的顏色
For x = 0 To T
xD(Ts + x & T1) = 0.1
xD(Ts + x & T2) = 0.1
Next
Next
For Each Ra In xA
'↑設定迴圈將xA裡的儲存格組成字串,
'(YYYY/M/D&Weekday)之後
'到xD字典裡查看看是否查得到,
'如果有就把儲存格放入Rng儲存格集裡
Ct = Ra & Format(Ra, "dddd")
If xD(Ct) Then
If Rng Is Nothing Then
Set Rng = Ra
Else
Set Rng = Union(Rng, Ra)
End If
End If
Next
xA.Interior.ColorIndex = xlNone
'↑把A:G欄的色全部變為無底色