I need to copy 20+ files, each housed by unique folders, into a single folder.
I created the below code.
I get
Compile Error: Object required.
Folder name is the date of the report (eg. 090118), hence, I decided to use a loop until the end of the month (931). I also added error handling code to skip the holidays and weekends.
Sub CopyFiles()
Dim NewFolder As String
Dim NDay As Long
Dim FileName As String
Dim Month As Variant
Set Month = InputBox("Enter month, eg. 01-January")
NewFolder = "C:\Results\Trading\2018\" & Month & "\Backtest Daily Files\Daily GS\" 'Don't forget to edit this
NDay = 901
On Error Resume Next
Do While NDay < 931
FileName = Dir("C:\Reports\2018\" & Month & "\0" & NDay & "18\GS_Futures*.cs*")
FileCopy FileName, NewFolder
NDay = NDay + 1
Loop
End Sub