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

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
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,415
Messages
6,119,375
Members
448,888
Latest member
Arle8907

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