working with multiple files

nootopian

New Member
Joined
Apr 14, 2002
Messages
1
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
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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
 
Upvote 0

Forum statistics

Threads
1,214,384
Messages
6,119,201
Members
448,874
Latest member
Lancelots

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top