Let's suppose I have WorkbookA, which contains worksheets with codenames FirstASheet and SecondASheet. It also includes a named range MyRangeA (scoped to Workbook), and two ranges named SheetRangeA (scoped to FirstASheet and SecondASheet, respectively).
And let's suppose I also have WorkbookB, which contains worksheets with codenames BeginBSheet and EndBSheet. It also includes a named range MyRangeB (scoped to Workbook), and two ranges named SheetRangeB (scoped to BeginBSheet and EndBSheet, respectively).
Note that the sheet names I'm using are the CODEnames, not the names on the sheet tabs.
Finally, suppose I have a macro in WorkbookA, that opens WorkbookB and manipulates data between the two files.
Can someone please explain to me how to reference the various sheets and named ranges within that macro? I'm used to simply using:
or![]()
Please Login or Register to view this content.
when working with a single file. But with two files open, it seems like Excel doesn't recognize references to the sheets or ranges in WorkbookA when WorkbookB is activated (and vice versa). Even if the names are unique.![]()
Please Login or Register to view this content.
What are the rules as far as which names are recognized for the active workbook and for ThisWorkbook (the file running the macro)? How do I refer to a sheet codename (or named range) in the non-active workbook?
Bookmarks