Tranferring names defined in one excel workbook to another workboo

G

Guest

I defined some names using name manager in One Excel workbook . i want to
transfer all the namespaces into another workbook.
How can i do that ?
 
G

Guest

Both workbooks need to have same sheet names in order for this to work
without error when you try to reference the named ranges in the second
workbook. Put this code in the workbook with the names already defined.
Open up the second workbook and then run the macro:

Sub CopyNamedNamedRanges()
Dim AnyName As Object

For Each AnyName In ThisWorkbook.Names
Workbooks("Book2.xls").Names.Add AnyName.Name, AnyName.RefersTo, True
Next

End Sub

Change "Book2.xls" to the name of the workbook you need to move the named
ranges into.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top