Extract list of all named ranges in a worksheet

mikeymay

Well-known Member
Joined
Jan 17, 2006
Messages
1,649
Office Version
  1. 365
Platform
  1. Windows
I am having a problem with extracting all the named ranges in a worksheet.

I thought the following would work but the there are no named ranges detected by the code
VBA Code:
Sub CopyToV7()

Dim wbV6 As Workbook

Dim wsV6 As Worksheet

Dim rngV6 As Range

Dim nmV6 As Name

Set wbV6 = ActiveWorkbook

Set wsV6 = wbV6.Sheets("File Data")

For Each nmV6 In wsV6.Names
    Debug.Print nmV6.Name, Range(nmV6).Address
Next

Set wsV6 = Nothing

Set wbV6 = Nothing

End Sub
1737010618005.png


From the above Watches window, the Names expression states there are none.

But in the Name Manager in Excel, there are a lot of named ranges
1737010703642.png


I have used this code before to extract the named ranges so I am not sure what, if anything has changed for this to now not work.

TIA[/CODE]
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,225,609
Messages
6,185,980
Members
453,333
Latest member
BioCoder84

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