Copy all range names from one workbook to another

Farmland

New Member
Joined
Aug 15, 2022
Messages
2
Office Version
  1. 2021
Platform
  1. Windows
Hi all,

I want to copy the names defined in one workbook "book1.xls" to tab "TD" in another workbook "Book2.xls".

The Source sheet used contains more than 1000 defined names. I tried a few codes I found online, but non of them worked.

I would really appreciate any advise you can give.

Thank you!
Sue
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi Sue, welcome to the MrExcel Forum.
How about this code placed in book1.xls. The code will place the results Book2 on Worksheets("TD") starting in Cell A1. If you don't want to start there, please change where indicated. Book2 must be open already.

VBA Code:
Sub findNames()

    Dim wb As Workbook: Set wb = ThisWorkbook
    Dim i As Long, arr
   
    ReDim arr(1 To wb.Names.Count, 1 To 2)
    For i = 1 To wb.Names.Count
       arr(i, 1) = wb.Names(i).Name
       arr(i, 2) = "'" & wb.Names(i).RefersTo
    Next
    Workbooks("Book2.xls").Worksheets("TD").Range("A1").Resize(UBound(arr), 2) = arr   'Change Range("A1") to your requirement

End Sub
 
Upvote 0
Thank you so much igold for your help. I really appreciate it.
 
Upvote 0
You're welcome, I was happy to help. Thanks for the feedback!
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,438
Members
449,083
Latest member
Ava19

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