Testing selection against named range

B

BartParry

I have a named range and when a user selects a cell I want to see if
their selection is inside that range. Any ideas?
 
D

Don Guillett

right click sheet tab>view code>insert this

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("ifrng")) Is Nothing Then MsgBox "Yes"
End Sub
 
C

c depalma

I have a problem where i could 10k named ranges. When i select an area of the sheet, i need to know which of those named ranges is selected. I have it working by looping over Workbook.names collection, but that takes 14 seconds. Any other way to ask excel what named ranges are intersecting the selection?
 
G

GS

Firstly, have 10k names is a really, really bad idea.

Secondly, having them workbook level is a really, really bad idea.

IMO, a better worksheet design would be more efficient...

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 

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

Top