Answered where? What is multiposting?
You can consolidate
With FldrPicker
.Title = "Select A Target Folder"
.AllowMultiSelect = False
If .Show <> -1 Then GoTo NextCode
myPath = .SelectedItems(1) & "\"
End With
' In Case of Cancel
NextCode:
myPath = myPath
If myPath = "" Then GoTo ResetSettings
With FldrPicker
.Title = "Select A Target Folder"
.AllowMultiSelect = False
If .Show <> -1 Then GoTo ResetSettings ' In Case of Cancel
myPath = .SelectedItems(1) & "\"
End With
I usually use GracefulExit as the line label before restoring Application settings. That term includes killing some objects and other good practices
' Target File Extension (must include wildcard "*")
myExtension = "*.xlsm"
' Target Path with Ending Extention
myFile = Dir(myPath & myExtension)
Can be
'Dim Mon as String
Mon = Format(DateAdd("m", Date, -1), "mmm") Returns 3 letter name of month before now.
'Don't use if you might skip a month
' Target Path with Ending Extention
myFile = Dir(myPath & "*" & Mon & ".xls*") 'Returns xls, xlsm, xlsx, xlsb files
'Or just
myFile = Dir(myPath & "*.xlsm")
"ThisWorkbook" is the standard CodeName for the workbook Object in an Excel file. It can be changed in an given workbook. "Me" is the VBA Workbook variable that always points to that workbook Object when used in ThisWorkbook or a standard Module.
Used in a UserForm, "Me" points to the UserForm, and in a Class Module, it points to the Object instantiated from that Class Module.
One question: where do we put the filtered data?