+ Reply to Thread
Results 1 to 7 of 7

referencing many closed workbooks

  1. #1
    Forum Contributor
    Join Date
    06-13-2008
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    277

    referencing many closed workbooks

    Hi Guys,

    I have a workbook for each day recording energy usage from 52 meters,

    I need to collate the data on a single workbook.

    The only way i can think of doing it is to use the INDIRECT function but this will not work on closed workbook.

    I need to sum the contents of B1:AW1 on the closed workbook and input that into a cell on the new sheet. then repeated for B2:AW2, B3:AW3 up to B52:AW52 once this has been done the process needs to be repeated for 31 workbooks.

    The end product should be 31 Columns (one for each day ini the last month) and 52 rown (one for each meter) and the total daily consumption for each meter (sum of column B:AW)

    I have no idea how this is going to happen but I think VBA may be the only solution.

    thank you for reading and even more thanks for helping
    Last edited by freud1; 11-09-2009 at 07:20 AM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: referencing many closed workbooks

    This is not meant as a solution but just a start to give you an idea.
    1. You need to create the array of workbook names,
    2. You will need to control the starting row in the master where the sum will be entered.

    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Forum Contributor
    Join Date
    06-13-2008
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    277

    Re: referencing many closed workbooks

    Hi Proton,

    Ok Im a little clueless when it comes to certain things, could you please explain a little more.

    I have been looking online and the only way looks to be an add on called morefunc which has an indirect function for closed workbooks, however as this is being installed on multiple machines down on site this is not the best way.

    many thanks

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: referencing many closed workbooks

    You should provide a workbook with sample data. Since we don't know what your workbooks look like, the macro was just a hint of a possible solution.

    The macro that I provided above is basically a loop. To use it, you will have to modify the line:
    FilePath = "C:\Documents and Settings\Benjamin\Desktop\"
    to reflect the drive and directories where your closed workbooks are found.

    Next, the line:
    WorkbookList = Array("the closed one")
    would be modified to include the names of the workbooks you wish to open. Something like:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-13-2008
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    277

    Re: referencing many closed workbooks

    thanks for getting back to me.

    I have attached and example of the file i am trying to reference : 01031109.xls (Format "01ddmmyy.xls")

    Also i have attched the template im trying to reference to : Book2.xls

    The files are energy consumptions. The daily spreadshets im trying to reference are created automatically every day in the format "01ddmmyy" and are stored in the directory in a folder with format "yymm" so example today's file will be located in:

    C:\Directory\0911\01051109.xls.

    My aim with this is to be able to total the daily consumptions on each row and report back on the last 31 days on the same sheet.

    As it is the last 30 days the dates and files which need to be referenced will be constantly changing.

    hope this sheds a little light on it.

    Many Many thanks
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: referencing many closed workbooks

    I think this may be close to what you are looking for.
    Please Login or Register  to view this content.
    Note that the subfolders must be in "C:\DIRECTORY"
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    06-13-2008
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    277

    Re: referencing many closed workbooks

    Proton this is fantastic! it does excactly what I need! and has populated the sheet with the last 30 days usage.

    I even managed to change the references to use the macro to gather more than 30 days usage,

    Thank you so much for your help with this. it still astounds me how much effort you guys are willing to put into helping mere novices like myself.

    eternally greatful

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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