Hi. I found a Macro on bitesizebio that Mr. Hengen was nice enough to provide.
I was using it to make a heat map and it was working fine, then one day,
it stopped working and I received the following error: Variable Not Defined (referring to 'rangetocheck')
I tried defining 'rangetocheck' as a range but then I get an error code: Variable not defined (referring to 'cell' in the 'For Each cell In Myrange' line)
Can any one tell me what happened to this macro? And why it worked one day but not the next?
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
End Select
cell.Interior.ColorIndex = colchoice
cell.Font.ColorIndex = fontchoice
fontchoice = 1
Next
End Sub
Thanks so much
Bookmarks