ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How export all Names to another workbook? (https://www.excelbanter.com/excel-programming/336988-how-export-all-names-another-workbook.html)

Maria J-son

How export all Names to another workbook?
 
Hi brains,

I got a workbook with many named ranges & objects etc and I don't want to
hack them all into Define name - Refere to: window one by one. How can I
transfere them to another workbook? I guess there is some vba needed for
this...


/Regards



Norman Jones

How export all Names to another workbook?
 
Hi Maria,

Try:

Sub CopyNames()
Dim Nme As Name
Dim WB1 As Workbook
Dim WB2 As Workbook

Set WB1 = Workbooks("BookTWO") '<<====== CHANGE
Set WB2 = Workbooks("BookONE") '<<====== CHANGE

For Each Nme In WB1.Names
WB2.Names.Add Nme.Name, RefersTo:=Nme.RefersTo
Next

End Sub


---
Regards,
Norman



"Maria J-son" wrote in message
...
Hi brains,

I got a workbook with many named ranges & objects etc and I don't want to
hack them all into Define name - Refere to: window one by one. How can I
transfere them to another workbook? I guess there is some vba needed for
this...


/Regards





All times are GMT +1. The time now is 07:02 PM.

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