+ Reply to Thread
Results 1 to 10 of 10

Variable workbook name in table call

  1. #1
    Registered User
    Join Date
    09-27-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Variable workbook name in table call

    Hey all,
    I'm trying to write a macro that copies data from a row in a different workbook to the given row in the current workbook. Help?

    I have...

    Please Login or Register  to view this content.
    I want something along the lines of

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Variable workbook name in table call

    Hello ekneen,

    Welcome to the Forum!

    What problems are you having with the code?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    09-27-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Variable workbook name in table call

    "Compile error:
    Expected: end of statement"

    Please Login or Register  to view this content.
    That line is highlighted red.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Variable workbook name in table call

    Hello ekneen

    Maybe this is not relevant, In your original post you had
    ActiveCell.FormulaR1C1 = "='101-Summary.xlsm'!Table1[Location]"

    In the line that is faiiing you do not have = "101" prefix added.
    ActiveCell.FormulaR1C1 = "" &Path& "-Summary.xlsm!Table1[Location]"

  5. #5
    Registered User
    Join Date
    09-27-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Variable workbook name in table call

    Hi Leith,

    The error line I posted is from the second block of the original code which shows what I want the code to act like. I am trying to replace the "101" from the line you just inputted with the value of a cell.

    Thanks for your help!

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Variable workbook name in table call

    Hello ekneen,

    Are your referring to this cell?
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-27-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Variable workbook name in table call

    Yes.

    I want to make

    Please Login or Register  to view this content.
    work like...

    Please Login or Register  to view this content.
    Where Path is defined by...

    Please Login or Register  to view this content.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Variable workbook name in table call

    Hello ekneen,

    Don't you need to add the equal sign back into the formula, like this...
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    09-27-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Variable workbook name in table call

    still throws the same error

  10. #10
    Registered User
    Join Date
    09-27-2010
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Variable workbook name in table call

    Resolved...


    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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