View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dag Johansen[_5_] Dag Johansen[_5_] is offline
external usenet poster
 
Posts: 19
Default Given a cell, find the named range it belongs to

Hi,

how can I reliably and efficiently determine if a cell "is
a member of" a named range, i.e. if it is part of a named
range?

It should work looping trough all Names, determine if the
name refers to a range, and if so loop through the cells
of the range and compare with the "pivot" (the given cell)
using the Is operator. If a match is found, return the
named range (i.e. stop looping immediately); if loop
terminates, return Nothing.

But is there a better way? It seems to me if there are
lots of/huge named ranges in a workbook this method might
be a little slow.

Any ideas?