In a macro I am using the following code:
With Range("T2:X31")
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=$R2=0"
.FormatConditions.Add Type:=xlExpression, Formula1:="=$AE2"
.FormatConditions.Add Type:=xlExpression, Formula1:="=$AF2"
.FormatConditions(1).Interior.Color = RGB(216, 216, 216)
.FormatConditions(1).Font.Color = RGB(216, 216, 216)
.FormatConditions(2).Interior.Color = RGB(255, 40, 40)
.FormatConditions(2).Font.Color = RGB(255, 255, 255)
.FormatConditions(3).Interior.Color = RGB(255, 128, 0)
.FormatConditions(3).Font.Color = RGB(0, 0, 0)
End With
What I would like to get in excel when I check the conditional formatting rules is (entered manually):
What I get instead is
where everything is ok except the row (1046053 instead of 2). How should I enter the cell reference to get the right formula.

