HI,
When I start a macro that will work with two or more workbooks, I always
have:
Dim ThisBook as Workbook
Set ThisBook=ActiveWorkbook
When I open a second workbook for data:
Dim DataBook as Workbook
Set DataBook=ActiveWorkbook
Now I simply use the workbook variables to qualify which range form which
workbook to use.
--
Rod Gill
Project MVP
NEW!! Project VBA Book, for details visit:
http://www.projectvbabook.com
"Jason" wrote in message
...
I am trying to use some code to copy and paste a variety of cells from a
master workbook ("WB1", which contains the code) to a second WB ("WB2").
The
name of WB1 is fixed and will not change. However, WB2 will not always
have
the same filename. I would generally only be doing this one workbook at a
time, i.e. I will have WB1 open along with WB2, and then run the code. Is
there a way using code to reference/activate WB2 while I am in WB1 without
having to use the filename of WB2 (it will not always be the same)?
Thanks.