# Sean Lauber:Heat maps in Excel

### From OpenWetWare

(Difference between revisions)

Sean E. Lauber (Talk | contribs)

(New page: Use the following macro: Sub heatmap() Dim myrange As Range Dim colchoice As Integer Set myrange = Application.InputBox("Select a range of cells", rangetocheck, , , , , , 8) For...)

Next diff →

## Revision as of 10:38, 26 October 2012

Use the following macro:

Sub heatmap() Dim myrange As Range Dim colchoice As Integer Set myrange = Application.InputBox("Select a range of cells", rangetocheck, , , , , , 8) For Each cell In myrange Select Case cell.Value Case Is >= 8 colchoice = 1 fontchoice = 2 Case Is >= 7 colchoice = 3 Case Is >= 6 colchoice = 45 Case Is >= 5 colchoice = 6 Case Is >= 4 colchoice = 19 Case Is >= 3 colchoice = 20 Case Is >= 2 colchoice = 8 Case Is >= 1 colchoice = 41 Case Is < 0 colchoice = 5 fontchoice = 2 End Select cell.Interior.ColorIndex = colchoice cell.Font.ColorIndex = fontchoice fontchoice = 1 Next End Sub