+ Reply to Thread
Results 1 to 7 of 7

Excel VBA reference cell in worksheet for workbook to open

  1. #1
    Registered User
    Join Date
    07-08-2017
    Location
    Minnesota
    MS-Off Ver
    Microsoft Office 2016
    Posts
    74

    Excel VBA reference cell in worksheet for workbook to open

    Hello,

    Can someone please help with the last question on the below forum link?

    https://www.excelforum.com/excel-pro...-pathways.html

    I am wondering if I can make it so the workbook names can be referenced in column F too, so I do not need to go into VBA and type each workbook name anytime there is an update and can just do so in column F?


    Please Login or Register  to view this content.
    I tried a few variations of below.
    Please Login or Register  to view this content.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,164

    Re: Excel VBA reference cell in worksheet for workbook to open

    Hi Hoover5896
    Something like this perhaps...
    Please Login or Register  to view this content.
    Last edited by sintek; 07-14-2017 at 07:36 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    07-08-2017
    Location
    Minnesota
    MS-Off Ver
    Microsoft Office 2016
    Posts
    74

    Re: Excel VBA reference cell in worksheet for workbook to open

    I tried:

    Please Login or Register  to view this content.
    but I am getting an error. I attached the workbook for reference. I am trying to get the macro to reference F2 and downwards as the Excel file name for it to go into and pull the sum of column C divided by 2 on the Trial Balance worksheet.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Excel VBA reference cell in worksheet for workbook to open

    Two things I noticed in glancing at your code. You have what appears too be an unnecessary "Next" towards the center of your code. The values in Column F appear as you state to be workbooks, but you define wbnames as worksheets?

  5. #5
    Registered User
    Join Date
    07-08-2017
    Location
    Minnesota
    MS-Off Ver
    Microsoft Office 2016
    Posts
    74

    Re: Excel VBA reference cell in worksheet for workbook to open

    I tried fixing that but I still receive the same Run-time error '424' object required. It looks like it is failing at:
    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Excel VBA reference cell in worksheet for workbook to open

    I think you have to:

    Please Login or Register  to view this content.
    Maybe:

    Please Login or Register  to view this content.
    I don't see in your code where you are opening any workbooks. Is that your intention? Or will they already be open?

  7. #7
    Registered User
    Join Date
    07-08-2017
    Location
    Minnesota
    MS-Off Ver
    Microsoft Office 2016
    Posts
    74

    Re: Excel VBA reference cell in worksheet for workbook to open

    Someone else has made this code actually so I am not too familiar with it, but the workbooks will be closed and not open.

    Currently my workbook macro is as follows and pulls the workbook data as needed, but I would like the macro to reference column F2 and down for workbook names instead of having to type them into the macro.
    Please Login or Register  to view this content.

    Similar to how this macro is pulling the pathway names from G2 and down so I do not have to have the pathways defined in the macro. This way I can easily manipulate the cells (workbook names in F2 and down, and file pathways in G2 and down without having to go into VBA).
    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)

Similar Threads

  1. open worksheet in a different workbook based on cell name in original workbook
    By thara95 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-03-2017, 07:38 AM
  2. [SOLVED] Macro to open workbook and go to specific worksheet based on cell reference
    By ajmartin17 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-15-2013, 10:44 AM
  3. Replies: 0
    Last Post: 10-11-2012, 10:48 PM
  4. Open a workbook using a cell reference
    By Grouhoule in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2012, 02:34 PM
  5. Open a closed worksheet w/ cell reference
    By SMB in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-08-2010, 10:56 AM
  6. Open a workbook from cell reference
    By george1982 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-23-2008, 04:49 AM
  7. Replies: 1
    Last Post: 12-01-2005, 09:10 PM

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