I've developed a routine with brute force rather than finesse that
will change the interior color of a cell in a column if it is within a
certain percentage of either the highest or lowest value in the column
range.

It works, but I'm sure there is a better (more efficient, use of
parameters, use of variables, etc.) or more standardized way of
accomplishing the same.

Could someone please show me the better way? Maybe there's already a
routine out there to do the same.

Thanks,

Hexman
----------------------------------------------------------
The routine is called with:

Call HLCell("F5", 1000, True, 4.5, 22)

rngTop is the column starting cell
cntRows is the # of rows to include in the range
bSrchHigh is for checking either highest or lowest
dPct is percentage from high or low
iColor is the color to highlight the cell

----------------------------------------------------------
Public Sub HLCell(ByVal rngTop As Range, _
ByVal cntRows As Long, _
ByVal bSrchHigh As Boolean, _
ByVal dPct As Double, _
ByVal iColor As Integer)
Dim rngWork As Range
Dim rngWork1 As Range
Dim dMin As Double
Dim dMax As Double
Dim dLowVal As Double
Dim dHighVal As Double
Dim iRow As Integer
Dim iRowCnt As Integer
Dim idx As Integer
Set rngWork = rngTop
Set rngWork1 = rngWork.Offset(cntRows, 0)

iRow = rngWork.Offset(cntRows, 0).End(xlUp).Row
iRowCnt = iRow - rngWork.Row
dMin = 0
dMax = 0
If IsNumeric(rngWork) Then
dMin = rngWork
dMax = rngWork
End If
For idx = 0 To iRowCnt
If IsNumeric(rngWork.Offset(idx, 0)) Then
If rngWork.Offset(idx, 0) > dMax Then
dMax = rngWork.Offset(idx, 0)
End If
If rngWork.Offset(idx, 0) < dMin Then
dMin = rngWork.Offset(idx, 0)
End If
End If
rngWork.Offset(idx, 0).Interior.ColorIndex = xlNone
Next
dHighVal = dMax * (dPct / 100)
dMax = dMax - dHighVal
dLowVal = dMin * (dPct / 100)
dMin = dMin + dLowVal
For idx = 0 To iRowCnt
If IsNumeric(rngWork.Offset(idx, 0)) Then
If bSrchHigh Then
If rngWork.Offset(idx, 0) >= dMax Then
rngWork.Offset(idx, 0).Interior.ColorIndex = _
iColor dk
End If
Else
If rngWork.Offset(idx, 0) <= dMin Then
rngWork.Offset(idx, 0).Interior.ColorIndex = _
iColor
End If
End If
End If
Next
End Sub