Если вы ищете VBA-решение, используйте свойство ячейки .Interior.TintAndShade
.
Вот быстрый макрос, который вы можете использовать, который вычисляет градиентную заливку в зависимости от количества ячеек в столбце. Это должно применять даже градиент, например .:
Sub Macro3()
Dim firstCell As Range 'the first cell, and the cell whose color will be used for all others.
Dim cellColor As Long 'the cell color that you will use, based on firstCell
Dim allCells As Range 'all cells in the column you want to color
Dim c As Long 'cell counter
Dim tintFactor As Double 'computed factor based on # of cells.
Set firstCell = Range("A1")
cellColor = firstCell.Interior.Color
Set allCells = Range("A1:A10")
For c = allCells.Cells.Count To 1 Step -1
allCells(c).Interior.Color = cellColor
allCells(c).Interior.TintAndShade = _
(allCells.Cells.Count - (c - 1))/allCells.Cells.Count
Next
End Sub
Отредактировано заполнить градиент от светло-до темно. Если вы предпочитаете темный свет, выполните следующие действия:
allCells(c).Interior.TintAndShade = _
(c-1)/allCells.Cells.Count
Thank you David! Прекрасно работает – Buras