How to verify 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.
 
One way:


Dim bSameSheet As Boolean
Dim bInRange As Boolean

With Range("TimeCells")
bSameSheet = .Parent Is ActiveSheet
If bSameSheet Then bInRange = _
Not Intersect(.Cells, ActiveCell) Is Nothing
End With
 

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