Reference workbook name to cell reference

B

Bob Maloney

Hi,

I have this line of code in workbook "Team 3.xls":
Sheets("Output").Copy After:=Workbooks("11_07 Summary Team
3.xls").Sheets(1)

Rather than manually replacing the name of the workbook each month (eg to
12_07 Summary Team 3.xls etc), is it possible to reference the workbook name
("11_07 Summary Team 3.xls") to a cell reference, say
Sheets("Data").Range("J11") which resides in Team 3.xls.

Any assistance appreciated.

Cheers

Bob
 
J

Joel

The parameter in the workbook function is a string a any string referrence
can be used. I would add an intermediate variable to make it easier to
understand the code

bookname = Sheets("Data").Range("J11")
Sheets("Output").Copy After:=Workbooks(bookname).Sheets(1)
 
O

Ozbobeee

Many thanks, Joel.

Cheers

Bob

Joel said:
The parameter in the workbook function is a string a any string referrence
can be used. I would add an intermediate variable to make it easier to
understand the code

bookname = Sheets("Data").Range("J11")
Sheets("Output").Copy After:=Workbooks(bookname).Sheets(1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top