ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How Do I list all range names in a worksheet (https://www.excelbanter.com/excel-programming/398335-how-do-i-list-all-range-names-worksheet.html)

Quietman

How Do I list all range names in a worksheet
 
I have a spreadsheet with over 1,000 range names. 90% are not valid anymore
I woul like to list all the range names thes be able to have the vba code go
through this list and delet all the ones that I tag as non needed

thanks
--
Helping Is always a good thing

JLGWhiz

How Do I list all range names in a worksheet
 
I found this in VBA help files.
Sub nms()
Set nms = ActiveWorkbook.Names
Set wks = Worksheets(1)
For r = 1 To nms.Count
wks.Cells(r, 2).Value = nms(r).Name
wks.Cells(r, 3).Value = nms(r).RefersToRange.Address
Next
End Sub

"QuietMan" wrote:

I have a spreadsheet with over 1,000 range names. 90% are not valid anymore
I woul like to list all the range names thes be able to have the vba code go
through this list and delet all the ones that I tag as non needed

thanks
--
Helping Is always a good thing


Tom Ogilvy

How Do I list all range names in a worksheet
 
Get the (free) Name Manager:

http://www.jkp-ads.com/OfficeMarketPlaceNM-EN.asp
at jkp's Application Development Service

--
Regards,
Tom Ogilvy



"QuietMan" wrote:

I have a spreadsheet with over 1,000 range names. 90% are not valid anymore
I woul like to list all the range names thes be able to have the vba code go
through this list and delet all the ones that I tag as non needed

thanks
--
Helping Is always a good thing


Quietman

How Do I list all range names in a worksheet
 
Thanks, good enough to get me started
--
Helping Is always a good thing


"JLGWhiz" wrote:

I found this in VBA help files.
Sub nms()
Set nms = ActiveWorkbook.Names
Set wks = Worksheets(1)
For r = 1 To nms.Count
wks.Cells(r, 2).Value = nms(r).Name
wks.Cells(r, 3).Value = nms(r).RefersToRange.Address
Next
End Sub

"QuietMan" wrote:

I have a spreadsheet with over 1,000 range names. 90% are not valid anymore
I woul like to list all the range names thes be able to have the vba code go
through this list and delet all the ones that I tag as non needed

thanks
--
Helping Is always a good thing



All times are GMT +1. The time now is 10:03 PM.

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