Hi Dave
I've got Windows 2000 Professional loaded on my system, I assume I have
Excel97.
I changed the range to start from D2 instead of A1. I have 2 work sheets.
One is where I input the data and the second one is the same as first but is
used to copy all the inputs made in sheet1, specifically from columns D to H.
On sheet 2 column G is the average of D to H (as copied from sheet1). (People
get distracted by seeing the colours change on the actual sheet). I am now
encountering 2 problems:
1. How do I set my range more effectively, below is what I have to do in
order for each of those cells to be activated. I just put a few in this code
in order to illustrate my point.
2. It seems that whatever colour is on cell d2, then the rest of the range
is the same colour, irrespective of what the data in the other cells are.
Thank you so much for all your help.
Regards
Rakesh
Option Explicit
Private Sub Worksheet_Calculate()
Dim myCell As Range
Dim myColorIndex As Long
Set myCell = Me.Range
"$d$2,$d$3,$d$4,$d$5,$e$2,$e$3,$e$4,$e$5,$f$2,$f$3,$f$4,$f$5,$g$2,$g$3,$g$4,$g$5,$h$2,$h$3,$h$4,$h$5")
If IsNumeric(myCell.Value) Then
Select Case myCell.Value
Case Is = 0: myColorIndex = 0 'White
Case Is <= 1: myColorIndex = 5 'Blue
Case Is <= 2: myColorIndex = 4 'Green
Case Is <= 3: myColorIndex = 6 'Yellow
Case Is <= 4: myColorIndex = 46 'Orange
Case Is <= 5: myColorIndex = 3 'Red
Case Else
myColorIndex = xlNone
End Select
Else
myColorIndex = xlNone
End If
myCell.Interior.ColorIndex = myColorIndex
End Sub