if anyone is interested here is how i did it :
Sub filesearch()
Dim fname As String
Dim sheetname As String
Range("A2").Select
Set fs = Application.filesearch
With fs
.LookIn = "Q:\Steel Monkey\excel\"
.Filename = "*.xls"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
For i = 1 To .FoundFiles.Count
fname = .FoundFiles(i)
If ActiveCell.Value <> fname Then
ActiveCell.Value = fname
Workbooks.Open Filename:="" & fname & ""
Cells.Copy
activeworkbook.close
Workbooks("Master.xls").Activate
Sheets.Add
Cells.PasteSpecial xlPasteAll
sheetname = Range("D3").Value
ActiveSheet.Name = sheetname
Sheets("Filelist").Select
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Offset(1, 0).Select
End If
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub
if anyone knows a better way to do this feel free to let me know as this probably isnt the best way!
Bookmarks