Verifying a cell is in a named range

  • Thread starter Thread starter Terry Lowe
  • Start date Start date
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.
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top