Tell me, is it possible in Excel to apply the condition ЕСЛИ(a>b; ЯЧЕЙКА КРАСНАЯ; ЯЧЕЙКА ЗЕЛЕНАЯ) for the selected cells?

    3 answers 3


    Выделить диапазон -> закладка «Главная» -> «Условное форматирование»

    and choose what you need. that's all.

      Conditional formatting "understands" the conditions, so the function in the formula is not required:

      = a> b

      = a <= b

      Perhaps the second condition is superfluous: initially fill the cell with green.

        Two options:

        1. Simplest. Use conditional formatting.
        2. Perverted. Write your function

           Sub fColor(cell As Range, b As Integer) ' Для примера первые десять строк и столбцов. 'i- номер строки 'j- Номер столбца For i = 1 To 10 For j = 1 To 10 If Cells(i, j) > b Then Cells(i, j).Interior.Color = 255 'красный Else Cells(i, j).Interior.Color = 5296274 'оттенок зеленого End If Next j Next i End Sub 
        • 1. Conditional formatting / Use the formula to determine formatted cells: (You write the formula, specify the range and format.) - Alexander Puzanov
        • I gave direction, not a solution. - Alexander Puzanov
        • At its discretion. There was an option with its own function. Nobody mentioned as useful, therefore, deleted. - Alexander Puzanov
        • That's right, this is VBA. - Alexander Puzanov
        • ' abc - is this a comment like this in vba? - Nick Volynkin