1 8
2 7
3 6
4 5
5 4
6 3
7 2
=SUMPRODUCT((FREQUENCY($A$1:$A$7,$B$1:$B$7)>0)*ISNUMBER($A$1:$A$8))
Or
=SUMPRODUCT((FREQUENCY($A$1:$A$7,$B$1:$B$7)>0)*(ROW($A$1:$A$8)<=ROWS($A$1:$A$7)))
Sub CondForm()
Dim ClrInd As Integer
Dim c As Range
For Each c In Sheet1.Range("A1:A100")
Select Case c.Value
Case "": ClrInd = xlNone
Case 0 To 6: ClrInd = c.Value + 35 '(the max in colorindex is 56, so choose correctly)
Case Else: ClrInd = xlNone
End Select
c.Interior.ColorIndex = ClrInd
Next c
End Sub
Sub CondForm()
Dim ClrInd As Integer
Dim c As Range
For Each c In Worksheets("enter results").Range("L3:L1000")
Select Case c.Value
Case "": ClrInd = xlNone
Case 0 To 6: ClrInd = c.Value + 35 '(the max in colorindex is 56, so choose correctly)
Case Else: ClrInd = xlNone
End Select
c.Interior.ColorIndex = ClrInd
Next c
End Sub
Now if you wish that it runs automatically when the user changes values in L3:L1000, we can use the event Change of the worksheet
Code to copy in Module of your Sheet and notice if values in column L change by formulas, the code won't work
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ClrInd As Integer
Dim c As Range
If Not Intersect(Target, Range("L3:L1000")) Is Nothing Then
For Each c In Intersect(Target, Range("L3:L1000"))
ClrInd = xlNone
Select Case c.Value
Case ""
Case 0 To 6: ClrInd = c.Value + 35
End Select
c.Interior.ColorIndex = ClrInd
Next c
End If
End Sub
Sub CondForm()
Dim ClrInd As Integer
Dim c As Range
For Each c In Worksheets("enter results").Range("L3:L1000")
ClrInd = xlNone
Select Case c.Value
Case ""
Case 0 To 6: ClrInd = c.Value + 35
End Select
c.Interior.ColorIndex = ClrInd
Next c
End Sub
Sub CondForm()
Dim ClrInd As Integer
Dim c As Range
For Each c In Sheets(""enter results").Range("L:L")
Select Case c.Value
Case "": ClrInd = xlNone
Case 0 To 6: ClrInd = c.Value + 35 '(the max in colorindex is 56, so choose correctly)
Case Else: ClrInd = xlNone
End Select
c.Interior.ColorIndex = ClrInd
Next c
End Sub