Solved

Copying Defined Names in Excel

Posted on 2013-11-17
9
1,627 Views
Last Modified: 2013-11-19
EE Pros,

I have a large number of "Range Names" that I'm trying to copy from one Worksheet to another.  There doesn't seem to be an easy way to do this; forcing me to redo each of the Range names.  Is there a way to copy a number of Range names at one time from one Workbook to another.

Thank you in advance.

B.
0
Comment
Question by:Bright01
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 6

Assisted Solution

by:Michael
Michael earned 150 total points
ID: 39654515
Hi B.

you can try this solution. Be sure to have both workbooks open, have the source workbook active and change the name of your destination workbook in the macro accordingly:

 Sub Copy_All_Defined_Names()
   ' Loop through all of the defined names in the active workbook.
     For Each x In ActiveWorkbook.Names
      ' Add each defined name from the active workbook to the target workbook ("Book2.xls").
      ' "x.value" refers to the cell references the defined name points to.
      Workbooks("Book2.xls").Names.Add Name:=x.Name, _
         RefersTo:=x.Value
   Next x
End Sub

Open in new window

Be sure to test this code first on a copy of your workbooks.

Joop
0
 
LVL 21

Expert Comment

by:Ejgil Hedegaard
ID: 39654781
If you copy the sheet to the other workbook, all names with reference to that sheet, will also be copied to the new workbook, and have the same sheet references.
0
 

Author Comment

by:Bright01
ID: 39654865
Is there any way to copy (besides one at a time) without using a Macro?  And if I do use the Macro, do I put it in a Module in the target WB or the specific target WS?

Thank you,

B.
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 6

Expert Comment

by:Michael
ID: 39654910
You can try hgholt's suggestion for a non-macro solution.

If you use the macro, place it in either workbook in a module. As long as you have the source workbook active when you execute it.

Joop
0
 
LVL 21

Assisted Solution

by:Ejgil Hedegaard
Ejgil Hedegaard earned 150 total points
ID: 39654994
You can copy all sheets in one process.
Activate the first sheet.
To group a series of sheets hold down the Shift key and point at the last sheet tab.
To group non contiguous sheet, hold down the Ctrl key and point at the sheet tabs one at a time.
Then right-click at one of the activated tabs and copy the sheets.
To deactivate the sheet group activate a  sheet not in the group.
0
 

Author Comment

by:Bright01
ID: 39655198
Hgholt,

Just to be clear, I'm trying to copy "names" (Formulas; Range Names) over.  I understand that if I copy a sheet or multiple sheets the range names come over, but if I'm simply coming Range Names in the  Name Manager, I can not seem to copy multiple names at one time.  That means if I don't copy the sheets but want to copy the Names, I have to recreate the Names one at a time.  That's what I'm trying to see if there is a way to simply copy and paste or drop and drag.  

Does your approach by coping over the sheets and then not activating them.....will that work?

B.
0
 
LVL 4

Accepted Solution

by:
yuppydu earned 200 total points
ID: 39656178
There is a very useful add-in developed by Rob Bovey which adds a set of utility in the excel ribbon. One of them lets you export all range names in a separate sheet. From there you can easily recreate all range names in a new workbook.
The link to get the add-in for free: www.appspro.com/Utilities/ExcelUtilities.htm
0
 

Author Closing Comment

by:Bright01
ID: 39659258
Thanks guys; I can use all of these methods but I really like the utility!

All the best,

B.
0
 
LVL 4

Expert Comment

by:yuppydu
ID: 39659387
Well thanks Rob!
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question