ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Testing selection against named range (https://www.excelbanter.com/excel-discussion-misc-queries/150374-testing-selection-against-named-range.html)

[email protected][_2_]

Testing selection against named range
 
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?


Don Guillett

Testing selection against named range
 
right click sheet tabview codeinsert this

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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
ps.com...
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?



[email protected][_2_]

Testing selection against named range
 
Nice. Figured there was something like that out there.


On Jul 16, 12:30 pm, "Don Guillett" wrote:
right click sheet tabview codeinsert this

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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message

ps.com...

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?




Don Guillett

Testing selection against named range
 
Glad to help

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
ups.com...
Nice. Figured there was something like that out there.


On Jul 16, 12:30 pm, "Don Guillett" wrote:
right click sheet tabview codeinsert this

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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
wrote in message

ps.com...

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?





c depalma

right click sheet tabview codeinsert thisPrivate Sub
 
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?

On Monday, July 16, 2007 12:19 PM BartParr wrote:


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?



On Monday, July 16, 2007 12:30 PM Don Guillett wrote:


right click sheet tabview codeinsert this

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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

wrote in message
ps.com...



On Monday, July 16, 2007 2:08 PM BartParr wrote:


Nice. Figured there was something like that out there.



On Monday, July 16, 2007 3:05 PM Don Guillett wrote:


Glad to help

--
Don Guillett
Microsoft MVP Excel
SalesAid Software





GS[_2_]

right click sheet tabview codeinsert thisPrivate Sub
 
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




All times are GMT +1. The time now is 07:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com