View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default Comparing Values from 2 cells

Reggie,

Try this:

e.g in Cell A1 put "=IsInRange(B89,F90)" (no quotes) and function will
return TRUE or FALSE.

in VBA:
Dim Check as boolean
Check=isInRange(Range("B89"),range("F90"))

Function IsInRange(ByRef rng As Range, cv As Range) As Boolean
Dim lv As Double, uv As Double
lv = CDec(Left(rng.Value, InStr(1, rng, "-") - 1))
uv = CDec(Right(rng.Value, InStrRev(rng, "-") - 1))
If cv.Value = lv And cv.Value <= uv Then
IsInRange = True
Else
IsInRange = False
End If
End Function

HTH

"Reggie" wrote:

I working on a form where there is a Value in cell B89 and there is a value
in cell F90. I need excel to determin if the value in F90 falls in the range
of the value for cell B89..

example:

cell B89 value = 3.5 - 5.0 (not minus sign) this values also changes...
Cell F90 value (user entered value) = 4.5

i need excel to see if 4.5 falls in the range of 3.5 - 5.0