How do I reference a workbook using a codename?

toddot04

New Member
Joined
Jul 1, 2015
Messages
13
So here is my problem. I have 2 open workbooks. I need to copy a set of cells and paste it to a sheet in another workbook. I have to be able to reference the code-name because the file name is always changing because of users needing to update it.

Also in the best case I would like to be able to have it look into only the open workbooks because more then likely their will be lots of the same codename because of identical wb from other jobs on someone computer.

So as it stands I have:

DRun.ActiveSheet.Range("A4:k7").copy
Activewb("MR").Inventory.Range("A3").paste

Always comes back with an error.

I have no idea how to get this to work. New here and going crazy.
 
Last edited:
They are just right clicking the file and changing the name at the end of each job. Such as XY-Run#1.xls, then copy that file and rename it to XY-Run#2.xls
The inventory in the new Run file is what I'm trying to copy to the Inventory tab inside the Morning Report workbook (codename, MR).

This line "Update at the Start of Each Run from Run Report" in the wb MR.inventory is unique the that open workbook/tab.

Also something shorter is "v.2.04" i can hide that. its in h12 cell.
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
They are changing the name of the file.
If you look at a file, how do you know if it is the one that you are looking for?
 
Upvote 0
A "file" is a file on a computer, it might be an Excel file or a Word file or ...
A "Workbook" is an Excel object
A "worksheet" is a single worksheet, there can be many worksheets in a Workbook.

Are you talking about files or worksheets. Your use of codename suggests that you are talking about worksheets.


If the user is changing file names, how can you be sure that "Morning Report" is part of the name they change it to?

If you are having trouble with users doing things that you don't want (like changing file names) that is an training/HR issue that Excel is not competent to address.
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,356
Members
449,080
Latest member
Armadillos

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