I have code below to enable a user to select CSV files in a specified folder ,"\\tyr\reports\BR1", but when running the code the last folder is selected
Kindly amend my code
Kindly amend my code
Code:
Sub Open_Workbook()
FormulaMin
Delete_RowsBelowMinDate
Dim A As Variant
Dim LR As Long
ChDir "\\tyr\reports\BR1"
' Clear contents of "Data Import" sheet
With ThisWorkbook.Sheets("Data Import")
.UsedRange.ClearContents
End With
A = Application.GetOpenFilename(MultiSelect:=True)
If TypeName(A) = "Boolean" Then Exit Sub
Dim file As Variant
Application.ScreenUpdating = False
For Each file In A
With Workbooks.Open(file, Local:=True)
With Sheets(1)
.Range("A1:S" & .Range("A" & .Rows.Count).End(xlUp).Row).Copy _
Destination:=ThisWorkbook.Sheets("Data Import").Range("A" & Rows.Count).End(xlUp).Offset(1)
End With
.Close SaveChanges:=False
End With
Next
Application.ScreenUpdating = True
Del_Unwanted
RefreshAllPivots
End Sub