Hello,
thank you very much, now the macro works and colors the cells, but it does not calculate them correctly or I have not explained correctly what should be calculated and calculated.
The idea is from the cell that is in brown color - the number that is in it to add + the numbers that are at the end of the table and if it is above this value, then to do the coloring, not as it is now.
I give an explanation (it applies to all these calculations for all cells but this is to show and catch the idea: with row 12 and in the example the brown one is in cell A12.
So there the number in the brown cell is 140, to make it yellow, the first increase it must be 140+130 (this is the first reduction that is made from cell AB12. And if somewhere in the row there is = 270 or more to be in yellow, then 140+260(i.e. AC)= 400 and it must be in the next blue color. That is, if it is greater or equal then to do the coloring. Because at the moment when it compares, if in the example it sees in a given row, as in the table 140, any next cell if it is above 140 makes it in yellow color, which is not true.
And so on until the last set number in the range from AB to AK (this is to at the moment, in the future I may need to add more numbers to the rows after AK for comparison to the right.
Please look at your macro, which you made years ago in my first post, how you calculate from the desired cell + the numbers at the end of the column.
I will make a manual coloring, which will be for example and comparison and I will attach it again.
I will do the test in the worksheet "bg" on the 12th row
140+130
140+260
140+390
140+520
140+650
140+780
140+910
140+1040
140+1170
140+1300
this is for this row, for all the others it takes the numbers for its own row and does the comparisons and calculations.
If .Cells(1, c).Value >= T0 + T10 Then
.Cells(1, c).Interior.Color = rgbSpringGreen 'new color rgbPowderBlue
ElseIf .Cells(1, c).Value >= T0 + T9 Then
.Cells(1, c).Interior.Color = rgbOrchid 'new color
ElseIf .Cells(1, c).Value >= T0 + T8 Then
.Cells(1, c).Interior.Color = rgbOlive 'new color
ElseIf .Cells(1, c).Value >= T0 + T7 Then
.Cells(1, c).Interior.Color = rgbPowderBlue 'new color
ElseIf .Cells(1, c).Value >= T0 + T6 Then
.Cells(1, c).Interior.Color = vbBlue 'new color
ElseIf .Cells(1, c).Value >= T0 + T5 Then
.Cells(1, c).Interior.Color = vbGreen 'new color
ElseIf .Cells(1, c).Value >= T0 + T4 Then
.Cells(1, c).Interior.Color = vbRed
ElseIf .Cells(1, c).Value >= T0 + T3 Then
.Cells(1, c).Interior.Color = vbMagenta
ElseIf .Cells(1, c).Value >= T0 + T2 Then
.Cells(1, c).Interior.Color = vbCyan
ElseIf .Cells(1, c).Value >= T0 + T1 Then
.Cells(1, c).Interior.Color = vbYellow
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:=CFormula & T10
.FormatConditions(.FormatConditions.Count).Interior.Color = rgbSpringGreen 'new color
.FormatConditions(.FormatConditions.Count).StopIfTrue = True
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:=CFormula & T9
.FormatConditions(.FormatConditions.Count).Interior.Color = rgbOrchid 'new color
.FormatConditions(.FormatConditions.Count).StopIfTrue = True
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:=CFormula & T8
.FormatConditions(.FormatConditions.Count).Interior.Color = rgbOlive 'new color rgbPowderBlue
.FormatConditions(.FormatConditions.Count).StopIfTrue = True
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:=CFormula & T7
.FormatConditions(.FormatConditions.Count).Interior.Color = rgbPowderBlue 'new color rgbPowderBlue
.FormatConditions(.FormatConditions.Count).StopIfTrue = True
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:=CFormula & T6
.FormatConditions(.FormatConditions.Count).Interior.Color = vbBlue 'new color
.FormatConditions(.FormatConditions.Count).StopIfTrue = True
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:=CFormula & T5
.FormatConditions(.FormatConditions.Count).Interior.Color = vbGreen 'new color
.FormatConditions(.FormatConditions.Count).StopIfTrue = True
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:=CFormula & T4
.FormatConditions(.FormatConditions.Count).Interior.Color = vbRed
.FormatConditions(.FormatConditions.Count).StopIfTrue = True
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:=CFormula & T3
.FormatConditions(.FormatConditions.Count).Interior.Color = vbMagenta
.FormatConditions(.FormatConditions.Count).StopIfTrue = True
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:=CFormula & T2
.FormatConditions(.FormatConditions.Count).Interior.Color = vbCyan
.FormatConditions(.FormatConditions.Count).StopIfTrue = True
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:=CFormula & T1
.FormatConditions(.FormatConditions.Count).Interior.Color = vbYellow
.FormatConditions(.FormatConditions.Count).StopIfTrue = True End With