Verifying a cell is in a named range

T

Terry Lowe

I give up. I have been trying to figure this out but I can only get half of
it. I think I need "professional help"!

I have a range name "TimeCells". I need to write an IF statement to verify
that the activecell is within the bounds of the named range. Also I need to
verify that I am on the correct worksheet.

Any help would be greatly appreciated.
 
B

Bob Phillips

Terry,

This code does it

Sub Intersection()
On Error GoTo not_found
If Not Intersect(ActiveCell, Range("TimedCells")) Is Nothing Then
MsgBox "intersect found"
GoTo found
End If
not_found:
MsgBox "Not found"
found:
End Sub

Yopu will have to be on the same sheet to get an intersect, as the range
includes the sheet.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top