Hey guys, not sure if anyone can help me with this or not. I have been trying to make an excel macro that when run will look at all files in the folder that it resides in and copy a specific range within every spreadsheet in the folder to certain regions in worksheet. Basically I have a master workbook that compiles a bunch of data that is located in the same region of every spreadsheet placed in the folder. I can figure out the logistics of placing the given data, but I cannot for the life of me get the macro to even open each individual file within the folder. this is what I have come up with so far as a test to see if the macro will even open any of the files within the folder, but it does not seem to work.
Any help would be appreciated!
Sub ultimatemacro()
Dim i As Integer, wb As Workbook
With Application.FileSearch
.NewSearch
.LookIn = ActiveWorkbook.path
.SearchSubFolders = False
.Filename = "*.xls"
.Execute
For i = 1 To .FoundFiles.Count
'Open each workbook
Set wb = Workbooks.Open(Filename:=.FoundFiles(i))
'Perform the operation on the open workbook
wb.Sheets(1).Range("A1").Select
Range("A1") = "hi!"
'Save and close the workbook
wb.Save
wb.Close
'On to the next workbook
Next i
End With
End Sub
Any help would be appreciated!