J
Joe D
Hi Everyone,
I am trying to write a sub in a workbook that takes information from
all of the workbooks in a certain folder (C:\Folder\) and combines all
of the retrieved data into one cell on the workbook that collects the
data.
For instance, every workbook in the folder has a name in cell A1 (Bob,
Jim, Hank) which I want to combine in cell Al of the collecting book
(with a space or comma or line break... I am not sure yet).
So far I have this:
With Application.FileSearch
.NewSearch
.LookIn = "C:\Folder"
.SearchSubFolders = False
.Filename = "*.xls"
.MatchTextExactly = True
.FileType = msoFileTypeExcelWorkbooks
If .Execute() > 0 Then
MsgBox "There were "& .FoundFiles.Count &" file(s) found."
For i = 1 To .FoundFiles.Count
Workbooks.Open Filename:=.FoundFiles(i)
With ActiveWorkbook
*******
'take cell A1 from sheet1 and combine with the names
that are already in the collecting book to make a big list of names
*******
End With
Next i
Else
MsgBox "There were no files found"
End If
End With
End Sub
Obviously that is not working for me. I would very much appreciate a
solution to my current dilema.
Thanks in advance to anyone who can help,
Joe
I am trying to write a sub in a workbook that takes information from
all of the workbooks in a certain folder (C:\Folder\) and combines all
of the retrieved data into one cell on the workbook that collects the
data.
For instance, every workbook in the folder has a name in cell A1 (Bob,
Jim, Hank) which I want to combine in cell Al of the collecting book
(with a space or comma or line break... I am not sure yet).
So far I have this:
With Application.FileSearch
.NewSearch
.LookIn = "C:\Folder"
.SearchSubFolders = False
.Filename = "*.xls"
.MatchTextExactly = True
.FileType = msoFileTypeExcelWorkbooks
If .Execute() > 0 Then
MsgBox "There were "& .FoundFiles.Count &" file(s) found."
For i = 1 To .FoundFiles.Count
Workbooks.Open Filename:=.FoundFiles(i)
With ActiveWorkbook
*******
'take cell A1 from sheet1 and combine with the names
that are already in the collecting book to make a big list of names
*******
End With
Next i
Else
MsgBox "There were no files found"
End If
End With
End Sub
Obviously that is not working for me. I would very much appreciate a
solution to my current dilema.
Thanks in advance to anyone who can help,
Joe