Assembling external cell reference to display value from other workbooks

veni

New Member
Joined
Feb 22, 2010
Messages
3
Ok, now that I shocked you with an indiscriptive title but still have your attention, let me see if I can describe that better:

In one cell I have a reference to an external workbook, e.g. B1: \\server\path\filename.xls. In another cell (eg. B3) I would like to use that info add the sheet name and the row/column reference to it. Alternatively, the sheet name could be in a separate cell (e.g. B2).

In effect it is like what I can do in one step ('\\server\path\[filename.xls]Data'!X25) in two or three steps. This allows me to separate out the file I'm referring to, the sheet and the cell, so that when I need to change the file name, but sheet and cell reference stay the same, I would still end up with the right value.
<TABLE cellSpacing=0 cellPadding=0 border=1 noshade>
<TBODY><TR><TD></TD><TD>A</TD><TD>B</TD></TR>

<TR><TD>1 </TD><TD>file name</TD><TD>\\server\path\filename.xls</TD></TR>

<TR><TD>2</TD><TD>sheet</TD><TD>Data</TD></TR>

<TR><TD>3 </TD><TD>Info from other file's 'Data' sheet in X25

</TD><TD>how do I assemble the cell formula here?</TD></TR>



</TABLE>
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hi
Let A1=(Path) '\\server\path\
B1= filename.xls you can change it to suit your needs.
C1= Data'!X25
Code:
sub pull data
Cells(1,4) = cells(1,1) & cells(1,2) & cells(1,3)
end sub
ravi
 
Upvote 0
Thanks, but this didn't really produce anything usable. In fact, after setting pull_data (I assume it had to have a "_" in its name), I have to run a macro first to populate the field, and then all it did was to enter

\\server\path\filename.xlsData'!X25

in cell D1. I made these modifications to the VBA code:

Code:
Sub pull_data()
    Cells(1, 4) = "='" & Cells(1, 1) & "[" & Cells(1, 2) & "]" & Cells(1, 3)
End Sub

This produces the desired result in cell, but I was looking for something that wouldn't require VBA and can be used in situ. Purely for the reason that if the location of the resulting cell changes I would have to change the code and I would have to run a macro every time I would want to update the cells.

I was looking for something like
Code:
="'" & A1 & "[" & B1 & "]" & C1
as the cell formula. It's just that this doesn't produce the correct output. Is there a function that evaluates a string?
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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