+ Reply to Thread
Results 1 to 8 of 8

Excel VBA Sum a column from closed workbooks into current workbook w/ macro

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

    Excel VBA Sum a column from closed workbooks into current workbook w/ macro

    Hello Everyone,

    I am new to VBA and really want to dive into learning this! I am looking into how I would create a macro using VBA to go into 4 closed workbooks and sum the same column (C:C) on the same worksheet (Trial Balance) for each differently named workbook and insert the sum of each column into cells A1, A2, A3, A4 on the current workbook w/ the macro. Can anyone please give guidance on how to accomplish this? Any help is greatly appreciated!

    Thanks!
    Last edited by Hoover5896; 07-08-2017 at 12:47 AM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Excel VBA Sum a column from closed workbooks into current workbook w/ macro

    Example
    Please Login or Register  to view this content.

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

    Re: Excel VBA Sum a column from closed workbooks into current workbook w/ macro

    Hi Jindon, thanks for the quick response! So far I have:

    Please Login or Register  to view this content.

    But the macro when run wants me to locate the file location and select the worksheet for each workbook. So I must be missing a step in changing the string? It also creates a link to the workbook and I want to do zero data links if possible.
    Last edited by Hoover5896; 07-08-2017 at 01:38 AM.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Excel VBA Sum a column from closed workbooks into current workbook w/ macro

    If you look into a formula bar and see the formula after running the code.
    It should give you correct sheet name in the formula.
    Last edited by jindon; 07-08-2017 at 01:28 AM.

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

    Re: Excel VBA Sum a column from closed workbooks into current workbook w/ macro

    I am sorry, I am still really new to this so I am not getting the code right. I ran through the code and the formula bar says this for each of the 4 cells when pulled into the current macro workbook so a data link is being manually created so far, and I have to locate the file and sheet once I run the macro.

    Please Login or Register  to view this content.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Excel VBA Sum a column from closed workbooks into current workbook w/ macro

    You are missing back slush
    Please Login or Register  to view this content.

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

    Re: Excel VBA Sum a column from closed workbooks into current workbook w/ macro

    It works now and I added the /2 you mentioned. Perfect! Thank you so much!

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Excel VBA Sum a column from closed workbooks into current workbook w/ macro

    You are welcome.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

+ 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. Export data with two Criteria values from closed workbook to closed workbooks VBA
    By julielara in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2016, 01:56 PM
  2. In Current workbook- copy sheets from other workbooks and save in current workbook
    By johnnywinter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2016, 08:41 PM
  3. [SOLVED] Extracting values from latest closed workbook into current workbook?
    By biznez in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-23-2015, 09:34 PM
  4. Macro to get values from multiple closed workbooks into single open workbook
    By aman2059 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-10-2015, 08:36 AM
  5. Replies: 0
    Last Post: 03-27-2014, 12:38 PM
  6. vba vlookup updates current data's from closed workbook undefined name of workbooks
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2013, 06:53 AM
  7. Macro operates on 'closed' workbook & Current Active WB
    By BEEJAY in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-04-2011, 08:48 AM

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