Мне нужно сделать условный код, заставляющий определенные ящики менять цвет в зависимости от состояния другого ящика.
Option Explicit
Sub QuarterSalesData()
Dim Qtr_1 As Integer
Dim Qtr_2 As Integer
Dim Qtr_3 As Integer
Dim Qtr_4 As Integer
Dim One_Total As Integer
Range("Q2").Select
ActiveCell.FormulaR1C1 = "=RC[-15]+RC[-14]+RC[-13]"
Range("Q2").Select
Selection.AutoFill Destination:=Range("Q2:Q21"), Type:=xlFillDefault
Range("Q2:Q21").Select
Selection.AutoFill Destination:=Range("Q2:Q41"), Type:=xlFillDefault
Range("Q2:Q41").Select
Range("R2").Select
ActiveCell.FormulaR1C1 = "=RC[-13]+RC[-12]+RC[-11]"
Range("R2").Select
Selection.AutoFill Destination:=Range("R2:R41"), Type:=xlFillDefault
Range("R2:R41").Select
Range("S2").Select
ActiveCell.FormulaR1C1 = "=RC[-11]+RC[-10]+RC[-9]"
Range("S2").Select
Selection.AutoFill Destination:=Range("S2:S41"), Type:=xlFillDefault
Range("S2:S41").Select
Range("T2").Select
ActiveCell.FormulaR1C1 = "=RC[-9]+RC[-8]+RC[-7]"
Range("T2").Select
Selection.AutoFill Destination:=Range("T2:T41"), Type:=xlFillDefault
Range("T2:T41").Select
Именно здесь у меня возникают проблемы.Я хочу, чтобы этот код поворачивал только определенные строки в столбце A синим цветом, если выполнены условия в другом столбце.
Dim cell As Range
Const cutoff = 26223
For Each cell In Range("Q2:Q41")
If cell.Offset(0, 1).Value > cutoff Then Cells().Font.Color = vbBlue
Next
End Sub