ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Names of named ranges in active sheet only (https://www.excelbanter.com/excel-programming/379010-re-names-named-ranges-active-sheet-only.html)

Tom Ogilvy

Names of named ranges in active sheet only
 
Dim nm as Name, rng as Range
for each nm in thisworkbook.Names
set rng = nothing
on Error Resume Next
set rng = nm.ReferstoRange
on Error Goto 0
if not rng is nothing then
if rng.parent.name = Activesheet.name then
' this name is on the same sheet
end if
end if
Next

--
Regards,
Tom Ogilvy



"XP" wrote in message
...
In Excel 2003, is it possible to return only the Names of named ranges in
the
active sheet vs. the entire workbook?

Could someone please post example code on how to do this?

Must the range be named a certain way for the code to detect this info?

Thanks.





All times are GMT +1. The time now is 09:18 PM.

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