Pass worksheet name as a variable in the formula bar BUT in a link to another file!?

pirdop

Board Regular
Joined
Jul 27, 2010
Messages
72
Hello all,
how I can pass a worksheet name as a variable in a link to another workbook?

here is what I m trying to achieve: I have 2 workbooks Summary.xlsx and Data.xlsx
in the DATA workbook I have 2 worksheets: CARS and TRUCKS

now I want in function of what is in cell A1, A2, etc in the Summary file the links to automatically refer to the CARS/TRUCKS worksheet

in a single workbook the
Code:
INDIRECT(ADDRESS(2,2,,,A3))
combination works perfectly, but I cannot make it work with external workbooks. the variable(Sheetname) is stored in A3.

let's say that the absolute link link to the CARS sheet is:
Code:
[B]C:\Test\[Data.xlsx]CARS'!$B$2[/B]

so what I need is to change somehow the link to TRUCKS!$B$2.


thank you all
 
Last edited:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Thank you Andrew,

=INDIRECT("[Data.xlsx]"&ADDRESS(2,2,,,A3))

as indicated this works, I just removed the TRUCKS part from your formula. It is stored in the A3 cell and changes CARS, TRUCKS etc...

any possibility to make it work as a link i.e. no need to have DATA.xlsx opened?


 
Upvote 0
PS. the above doesn't seem to work with worksheet names containing spaces. !? given that in the cell a3 the string is absolutely the same
 
Upvote 0

Forum statistics

Threads
1,203,067
Messages
6,053,335
Members
444,654
Latest member
Rich Cohen

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