VBA: Checking if a Cell is Named

James_B

Active Member
Joined
Jun 11, 2009
Messages
447
Dear All,

Programatically speaking, can anyone think of a way of checking whether an arbitrary cell is part of a named range (that is, short of looping through an entire book's named ranges checking for intersections)? (If it helps, it can be assumed that all the named ranges consist only of one cell).

Cheers for any and all (sensible) ideas,

James.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hello

As far as I know, there is no different and elegant way. (don't know if it works but you wouldn't want to select the cell and then use the API to determine the contents of the Name Box, to the left of the formula bar).
 
Upvote 0
Hi,

I might be missing the point but perhaps try:

ActiveCell.Name.Name - and use relevant error handling for unnamed cells
 
Upvote 0
I stand corrected. Nice suggestion circledchicken.
 
Upvote 0
Exactly what I was after. Thanks a bunch. (Thanks for the thoughts too, Wigi. Though I don't imagine I'll be pursuing your API-based suggestion any time soon! :) )
 
Upvote 0

Forum statistics

Threads
1,215,236
Messages
6,123,798
Members
449,127
Latest member
Cyko

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top