De: Farzad Farahbod Objet: Re: finding named range that current cell resides Date : vendredi 24 septembre 1999 04:30 Thanks, I did use your approach. Best reagards FF Steve Mazzola wrote in message <7reo7i$s2m$1@nnrp1.deja.com>... >i use a slightly modified version as i found difficulties if there was >a formula in Refersto... This function returns the name the cell/range >is in or "" if not in any. > >Public function CellIsInWhatnamedrange(rng As range) As String > >dim namnamedrange As name >dim rngTest As range >On Error Resume next > >for each namnamedrange In activeworkbook.names > > set rngTest = application.Intersect(range(namnamedrange.name), rng) > > if Not rngTest Is Nothing then > CellIsInWhatnamedrange = namnamedrange.name > Exit function > end if > >next namnamedrange > >end function > > >In article , > "Farzad Farahbod" wrote: >> Bernie, >> Thanks a lot , it does work. Thanks again for the help and have a >great >> weekend. >> >> Best Regards >> FF >> >> Bernie Deitrick wrote in message <37D9A828.D39C731A@banet.net>... >> >Farzad, >> > >> >Try this. >> > >> >Bernie >> > >> >Sub DeterminerangeInclusion() >> >dim myname As name >> >dim myaddress, myMessage As String >> >dim Inrange As Integer >> > >> >myMessage = "Cell " & activecell.address & " is not in a range" >> >Inrange = 0 >> > >> >for each myname In application.names >> >myaddress = myname.Refersto >> >set b = Intersect(activecell, range(myaddress)) >> >if Not (b Is Nothing) then >> >if Inrange = 0 then >> >Inrange = 1 >> >myMessage = "Cell " & b.address & Chr(10) & Chr(13) & " is in " & >> myname.name >> >Else: myMessage = myMessage & Chr(10) & Chr(13) _ >> > & " and in " & myname.name >> >end if >> >end if >> >next myname >> > >> >msgbox myMessage >> >end Sub >> > >> > >> >Farzad Farahbod wrote: >> > >> >> Hi, >> >> Is there a way to find out what is the named range of current cell >is, >> for >> >> example if you are at $F4 cell and >> >> $F4 cell is inside ranged named "Stores", how would I find what is >the >> name >> >> of the range that >> >> $F4 belong to. >> >> >> >> Thanks for the help. >> >> FF >> > >> > >> > >> >> > > >Sent via Deja.com http://www.deja.com/ >Share what you know. Learn what you don't.