working with multiple files
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: working with multiple files

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I would like to have a summary workbook which calculates totals from several files in the same directory.

    Ive got this working fine but what i would like is if a new workbook is added to the directory the summary workbook would add this workbook to its calculations.

    all the workbooks will have the same format.

    perhaps there is a much better way of doing this.

    thanks

    greg

  2. #2
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Try the following:

    Code:
        Dim fs, f, f1, fc, i
        Set fs = CreateObject("Scripting.FileSystemObject")
        Set f = fs.GetFolder("C:My Documents")
        Set fc = f.Files
        For Each f1 In fc
        i = i + 1
        Worksheets("Summary").Range("A" & i).Value = f1.name
        Next
    The code searches for all files in a specific directory and puts their names in the Summary worksheet. Edit as needed.

    Be aware that a single slash on this message board is represented by a double slash (don't ask me why).
    _________________
    Hope this helps.
    Kind regards, Al.

    [ This Message was edited by: Al Chara on 2002-04-15 09:08 ]

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com