Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to test whether cell is a member of a range

Status
Not open for further replies.

electricpete

Technical User
Oct 1, 2002
289
US
Let's say I use the Worksheet_Change event which tells my a target cell or range.

I am assuming it will only be a single cell (will check for that).

I want to check whether that target cell lies within a named range (which is not a continguous set).

Is there an easy way to do this?

More generally, is there a way to test whether an object is a member of a collection?

As I type, I just thought of one way. Loop through each cell in the range and see if the address matches. Is there an easier way?
 
Have a look at the Application.Intersect method.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PH. That will work. I ended up using a loop to do it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top