最初のセルは白、2 番目のセルは少し暗く、3 番目のセルは前のセルよりも暗いなど、Excel 列のセルに異なる色を割り当てる必要があります。.png ファイルへのリンクは次のとおりです: https ://dl.dropboxusercontent.com/u/41007907/gradientColumn.png
どうすればこれをすばやく行うことができますか? ショートカットコマンドはありますか?
最初のセルは白、2 番目のセルは少し暗く、3 番目のセルは前のセルよりも暗いなど、Excel 列のセルに異なる色を割り当てる必要があります。.png ファイルへのリンクは次のとおりです: https ://dl.dropboxusercontent.com/u/41007907/gradientColumn.png
どうすればこれをすばやく行うことができますか? ショートカットコマンドはありますか?
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