Hi Team,
I currently have a Macro that works perfectly by looking at a specific Folder for the files it is pulling data from. Is there a simple way to convert it so it uses the File Picker instead so I can chose which folder it is looking at each time I run the Macro?
Thanks in Advance.
I currently have a Macro that works perfectly by looking at a specific Folder for the files it is pulling data from. Is there a simple way to convert it so it uses the File Picker instead so I can chose which folder it is looking at each time I run the Macro?
Thanks in Advance.
Code:
Sub Test()
Dim stgF As String, stgP As String
Dim wb As Workbook
Dim ws As Worksheet
Set ws = "C:\Documents\General CAD\_Blank Project\Supporting Files\Weld Log\"
stgP = Application.FileDialog(msoFileDialogFilePicker)
stgF = Dir(stgP & "\*.xls*")
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.DisplayAlerts = False
Do While stgF <> vbNullString
Set wb = Workbooks.Open(stgP & "\" & stgF)
With wb.Sheets(1)
.UsedRange.Offset(1).Copy ws.Range("A" & Rows.Count).End(3)(2)
ws.Columns.AutoFit
End With
wb.Close Save = True
stgF = Dir()
Loop
Columns("A:E").Select
Selection.ColumnWidth = 19
Application.Calculation = xlCalculationAutomatic
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub