У меня есть следующий VBA, настроенный таким образом, чтобы при изменении значения A9 он менял месяц в календаре, а A10 менял местоположение - он почти идеально выделял даты, выбранные для каждого, ОДНАКО, если дата отменена, и выделял красный, если он впоследствии забронирован, он не будет выделен желтым, чтобы показать это. Есть идеи?
https://ibb.co/HzFvQ5P - показывает настройки календаря.
If Not Intersect(Target, Range("A9")) Is Nothing Or Not Intersect(Target, Range("A10")) Is Nothing Then
Dim cell As Range
Dim mrng As Range
Dim loc As Range
Dim rcount As Long
Set mrng = Range("B9:H14")
Set loc = Range("A10")
rcount = Cells(2, "N").End(xlDown).Row
mrng.Interior.Color = xlNone
mrng.Borders.LineStyle = Excel.XlLineStyle.xlLineStyleNone
For Each cell In mrng
For x = 2 To rcount
If Cells(x, "T") = loc And Cells(x, "J") = "CONFIRMED" And cell >= Cells(x, "N") And cell <= Cells(x, "O") Then
cell.Interior.Color = vbYellow
End If
If Cells(x, "T") = loc And Cells(x, "J") = "PROV" And cell >= Cells(x, "N") And cell <= Cells(x, "O") Then
cell.Interior.Color = vbGreen
End If
If Cells(x, "T") = loc And Cells(x, "J") = "CANCELLED" And cell >= Cells(x, "N") And cell <= Cells(x, "O") Then
cell.Interior.Color = vbRed
End If
Next x
If cell = Date Then cell.BorderAround ColorIndex:=5, Weight:=xlMedium
Next cell
End If
End Sub