Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Brian
 
Posts: n/a
Default Linking a cell to another workbook cell based on a variable name

Hi all,

Is there any way that I can link a cell in Workbook A to a cell in Workbook
B(sheet1) based on a variable entry (workbook name) in Workbook A

Workbook A contains two cells

A1 = Workbook B (this is the variable name)
B1 = I want this to be the same as cell B1 in Workbook B

I will then want to copy the formula in Workbook A cell B1 to other cells so
that B2, B3 etc.. will contain the data from the respective cells in Workbook
B

Hope the above makes sense

Brian
Workbook B will contain date in cell B1 = John Smith
  #2   Report Post  
Bill Martin -- (Remove NOSPAM from address)
 
Posts: n/a
Default

Brian wrote:
Hi all,

Is there any way that I can link a cell in Workbook A to a cell in Workbook
B(sheet1) based on a variable entry (workbook name) in Workbook A

Workbook A contains two cells

A1 = Workbook B (this is the variable name)
B1 = I want this to be the same as cell B1 in Workbook B

I will then want to copy the formula in Workbook A cell B1 to other cells so
that B2, B3 etc.. will contain the data from the respective cells in Workbook
B

Hope the above makes sense

Brian
Workbook B will contain date in cell B1 = John Smith

------------------

Try:

[ ] = [WorkbookName]SheetName!A1

Good luck...

Bill
  #3   Report Post  
Brian
 
Posts: n/a
Default

Thanks for the reply, but I can't get this to work.

I know that I can use Paste Link to copy a cell from one Workbook to another
and this will be linked. But I need to be able to have a formula in a cell
that will copy the contents of another workbooks cell based on a workbook
name that will be in a cell in the first workbook.

"Bill Martin -- (Remove NOSPAM from addre" wrote:

Brian wrote:
Hi all,

Is there any way that I can link a cell in Workbook A to a cell in Workbook
B(sheet1) based on a variable entry (workbook name) in Workbook A

Workbook A contains two cells

A1 = Workbook B (this is the variable name)
B1 = I want this to be the same as cell B1 in Workbook B

I will then want to copy the formula in Workbook A cell B1 to other cells so
that B2, B3 etc.. will contain the data from the respective cells in Workbook
B

Hope the above makes sense

Brian
Workbook B will contain date in cell B1 = John Smith

------------------

Try:

[ ] = [WorkbookName]SheetName!A1

Good luck...

Bill

  #4   Report Post  
Bill Martin -- (Remove NOSPAM from address)
 
Posts: n/a
Default


Try:

[ ] = [WorkbookName]SheetName!A1

Good luck...

Bill


---------

The above does work. What error statements are you getting? My guess
is that you've perhaps not put the proper workbook name into the
formula? It should be the entire file name on your disk. Something like:

Workbook1.xls

And if it's not stored in your default Excel work folder, then you'd
need the entire file name. Something of the general form:

c:\MyDocs\Excel\Workbook1.xls

Bill
  #5   Report Post  
Brian
 
Posts: n/a
Default

You are right, it does work.

But I am looking for a way to reference a cell that will contain the filename:

so instead of =[WorkbookName]SheetName!A1

I would like =[Cell A1]SheetName!A1 where Cell A1 will be the filename

Not sure if that makes it any clearer

Brian

"Bill Martin -- (Remove NOSPAM from addre" wrote:


Try:

[ ] = [WorkbookName]SheetName!A1

Good luck...

Bill


---------

The above does work. What error statements are you getting? My guess
is that you've perhaps not put the proper workbook name into the
formula? It should be the entire file name on your disk. Something like:

Workbook1.xls

And if it's not stored in your default Excel work folder, then you'd
need the entire file name. Something of the general form:

c:\MyDocs\Excel\Workbook1.xls

Bill



  #6   Report Post  
Bill Martin -- (Remove NOSPAM from address)
 
Posts: n/a
Default

Brian wrote:
You are right, it does work.

But I am looking for a way to reference a cell that will contain the filename:

so instead of =[WorkbookName]SheetName!A1

I would like =[Cell A1]SheetName!A1 where Cell A1 will be the filename

Not sure if that makes it any clearer

Brian


----------------

You need to use the address format I gave you, and combine it with an
INDIRECT() statement. Look in the Excel help system for detailed info
on INDIRECT.

Basically you build up a text version of the address you need and insert
that into the INDIRECT() statement. For example, if your workbook name
is stored as text in cell A5, then:

[ ] = INDIRECT("[" & A5 & "]SheetName!A1")

Bill
  #7   Report Post  
Dave Peterson
 
Posts: n/a
Default

Just to add to Bill's response...

=indirect() won't work with closed workbooks.

Harlan Grove wrote a User Defined Function that can pull from a closed
workbook:

http://groups.google.co.uk/groups?se...wsranger.co m

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Brian wrote:

Hi all,

Is there any way that I can link a cell in Workbook A to a cell in Workbook
B(sheet1) based on a variable entry (workbook name) in Workbook A

Workbook A contains two cells

A1 = Workbook B (this is the variable name)
B1 = I want this to be the same as cell B1 in Workbook B

I will then want to copy the formula in Workbook A cell B1 to other cells so
that B2, B3 etc.. will contain the data from the respective cells in Workbook
B

Hope the above makes sense

Brian
Workbook B will contain date in cell B1 = John Smith


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format cell in column B based on value in the next cell (column c) Nicole Excel Discussion (Misc queries) 7 May 18th 05 10:19 PM
How do I automatically hide columns in a worksheet based on a cell value? dkhedkar Excel Worksheet Functions 1 March 5th 05 12:20 AM
changing value of a cell based on another cell color Gary Excel Discussion (Misc queries) 2 January 30th 05 10:19 AM
linking cell value in one workbook to a cell in another workbook Jig Bhakta Links and Linking in Excel 1 January 20th 05 06:12 PM
Delete Cell Value Based on Another Cell T or F DocuMike Excel Discussion (Misc queries) 3 January 5th 05 08:46 PM


All times are GMT +1. The time now is 12:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"