Is the active cell part of a named range
use the Intersect method
Sub Test()
msgbox IsInRange(Range("B5"),range("Data"))
End Sub
Function IsInRange(test as range, target as range) as Boolean
dim found as range
set found = Intersect(Test,target)
IsInRange = (NOT Found Is Nothing)
End Function
"Virginia" wrote in message
...
how do use VBA to determine whether or not the activecell is part of a
range
named "Data"
i.e., range("Data") spans from A1:J50
how can i return true on
range("B5") is part os range("Data")
TIA.
|