如何将渐变颜色分配给Excel列?

我需要为Excel列中的单元格指定不同的颜色,例如第一个单元格是白色的,第二个单元格是比较暗的,第三个比前一个单元格更暗。下面是指向.png文件的链接: https ://dl.dropboxusercontent.com/u/41007907/gradientColumn.png

我怎么能做到这一点? 有没有捷径命令?

如果您正在查找VBA解决scheme,请使用单元格的.Interior.TintAndShade属性。

这是一个可以使用的快速macros,根据列中单元格的数量计算渐变填充。 这应该应用一个均匀的梯度,例如:

渐变填充单元格

 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