PDA

View Full Version : Structure Help??



Hoopsah
03-06-2008, 07:35 AM
On a weekly basis I receive a completed worksheet from employees (20 in total).

These are saved in directories by Name and Date. What I have to do is compile a spreadsheet that merges all of the information and gives statistics on: End of week date, Tasks carried out (Number of) and the employees name.

I feel as though I have hit a brick wall as I cannot even think how to get this started.

Any help would be greatly appreciated,

Hoopsah

Bob Phillips
03-06-2008, 08:02 AM
Dim oFSO

Sub LoopFolders()

Set oFSO = CreateObject("Scripting.FileSystemObject")

selectFiles "c:\MyTest"

Set oFSO = Nothing

End Sub


'---------------------------------------------------------------------------
Sub selectFiles(sPath)
'---------------------------------------------------------------------------
Dim Folder As Object
Dim Files As Object
Dim file As Object
Dim fldr

Set Folder = oFSO.GetFolder(sPath)

For Each fldr In Folder.Subfolders
selectFiles fldr.Path
Next fldr

For Each file In Folder.Files
If file.Type Like "*Microsoft*Excel*" Then
Workbooks.Open Filename:=file.Path
'do the merge stuff
Activeworkbook.Close SaveChanges:=False
End If
Next file

End Sub