+ Reply to Thread
Results 1 to 9 of 9

copy information from a new workbook.

  1. #1
    Registered User
    Join Date
    06-07-2015
    Location
    United Kingdom
    MS-Off Ver
    2010
    Posts
    38

    copy information from a new workbook.

    I'm sure this would have been answered previously, but after a few days looking around here and other places on the internet, I've decided to ask the experts.

    So... to link to another document isn't to taxing and here is an example of what I mean:

    ='[test file for information.xlsx]Sheet1'!$A$2

    Now what that's doing is looking for the file "test file for information" It then goes to cell A2 on sheet one and displays the value in my current document.

    This is all great and works exactly how I want. However, I would like to be able to change the file name and sheet name in one place In the current workbook.

    so for example.... I have a column of cells pulling data from a different workbook (all cells referencing the same external workbook)... rather than going into that formula each time and changing the document name. I would like the document name to be a cell in the current workbook.

    I would like to get to the point where I enter the workbook, I type in the next documents name, then assuming the information is in the same place in that document the file is populated automatically.

    I've tried to explain this the best I can but I'm sure its still confusing. If you are able to help or have any questions don't hesitate to ask.

    Thanks in advance! Andy

  2. #2
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: copy information from a new workbook.

    You can use the indirect function.
    A1="'[test file for information.xlsx]Sheet1!'"
    To view the information '[test file for information.xlsx] Sheet1'!$A$2 you can use
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by José Augusto; 06-07-2015 at 07:15 AM.

  3. #3
    Registered User
    Join Date
    06-07-2015
    Location
    United Kingdom
    MS-Off Ver
    2010
    Posts
    38

    Re: copy information from a new workbook.

    Edit - No longer relevant..
    Last edited by homegrownandy; 06-08-2015 at 04:41 AM.

  4. #4
    Registered User
    Join Date
    06-07-2015
    Location
    United Kingdom
    MS-Off Ver
    2010
    Posts
    38

    Re: copy information from a new workbook.

    After looking around a bit this is what I'm currently working on,

    =INDIRECT("'["&A2&".xlsx]"&B2&"'!"&$D$28)
    =INDIRECT("'["&A2&".xlsx]"&B2&"'!"&C2)

    This does not work. Is there anything obvious I'm doing wrong?

    What I would like to know... A2 = document name. BUT how does it know the documents location? It doesn't appear to be in any of the code.

    I know this doesn't seem to matter if I do a direct copy from workbook 2 to workbook 1 (or link directly across spreadsheets).

    But when doing a manual line of code I'm unsure how to tell it where to look.

    Its possible for me to link manually through.. however, as I'm sure you can appreciate, I would like to get this as automated as possible.

    Thanks again!

    Andrew

  5. #5
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: copy information from a new workbook.

    Try this.....

    Assuming A2=test file for information and B2=Sheet1, then the following formula will be equivalent to ='[test file for information.xlsx]Sheet1'!$C$2
    Please Login or Register  to view this content.
    Does this help?
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  6. #6
    Registered User
    Join Date
    06-07-2015
    Location
    United Kingdom
    MS-Off Ver
    2010
    Posts
    38

    Re: copy information from a new workbook.

    This works perfectly mate, thank you very much. sorry to be a pain but there's one more way I would like to try.

    =INDIRECT("'["&A2&".xlsx]"&B2&"'!$C$2")

    !$C$2 <-- where this is I would like to link to link to a different sheet in the same document,

    =Sheet2!H12

    I'm unsure how to do the formatting of the code properly and I don't know what I'm looking for to learn these specifics. I get my code close each time.

    anyway, if you could help me with this last issue I would really appreciate it.

    so basically I have the option of changing which cell it pulls information from using a table on a different sheet. Its a little more complex than that, but I can achieve the rest once I have passed this issue.

    Thanks once again for the brilliant replies.

  7. #7
    Registered User
    Join Date
    06-07-2015
    Location
    United Kingdom
    MS-Off Ver
    2010
    Posts
    38

    Re: copy information from a new workbook.

    This works perfectly mate, thank you very much. sorry to be a pain but there's one more way I would like to try.

    =INDIRECT("'["&A2&".xlsx]"&B2&"'!$C$2")

    !$C$2 <-- where this is I would like to link to link to a different sheet in the same document,

    =Sheet2!H12

    I'm unsure how to do the formatting of the code properly and I don't know what I'm looking for to learn these specifics. I get my code close each time.

    anyway, if you could help me with this last issue I would really appreciate it.

    so basically I have the option of changing which cell it pulls information from using a table on a different sheet. Its a little more complex than that, but I can achieve the rest once I have passed this issue.

    Thanks once again for the brilliant replies.

  8. #8
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: copy information from a new workbook.

    To achieve this, place Sheet2 in B2 and replace $C$2 or C2 in the Indirect formula with $H$12 or H12.

    If that takes care of your original question, please mark your thread as Solved by selecting Thread Tools (just above your first post) --> Mark thread as solved.

  9. #9
    Registered User
    Join Date
    06-07-2015
    Location
    United Kingdom
    MS-Off Ver
    2010
    Posts
    38

    Re: copy information from a new workbook.

    Ideally I would like B2 to remain the same. I know this is confusing but ill try explaining it,

    a2 = Document to gather information from (document test)
    B2 = Sheet on that document (sheet test)
    and then the changing part of the formula is where to look for the cell in (document test). This information would be pulled from sheet 2 on the current document.

    a2 and b2 remain the same every time I use the formula but the last part is a variable from sheet 2.

    I hope I've explained this better, maybe you have a better way of doing it if I cant link from multiple sheets at once,

    thanks Andy!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Copy information from other workbook to main workbook help 2007
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-26-2013, 08:09 PM
  2. Copy and paste updated information from a Workbook to the same workbook
    By Vadimchik in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-13-2013, 04:49 AM
  3. Replies: 8
    Last Post: 02-26-2013, 08:10 AM
  4. Replies: 16
    Last Post: 11-19-2010, 11:10 AM
  5. [SOLVED] How do I copy the information from one workbook to another?
    By Marsha in forum Excel General
    Replies: 3
    Last Post: 10-17-2005, 10:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1