I have the following code to open a file in a folder and to copy the data
I would like the code amended so that a specific file is selected i.e Group Sales Report.xlsx in folder C:\Reports
It would be appreciated if someone could kindly amend my code
I would like the code amended so that a specific file is selected i.e Group Sales Report.xlsx in folder C:\Reports
Code:
Sub Open_Files()
Dim NB As Workbook, tw As Workbook, ts As Worksheet, shtCount%
A = Application.GetOpenFilename
If A = False Or IsEmpty(A) Then Exit Sub
With Application
.ScreenUpdating = False
End With
Set tw = ThisWorkbook
Set NB = Workbooks.Open(A)
ChDir "C:\Reports\"
With NB
For shtCount = 1 To .Sheets.Count
.Sheets(shtCount).UsedRange.Copy Destination:=tw.Sheets(shtCount).Range("A1") 'change to suit ones needs
Next shtCount
.Close False
End With
Set NB = Nothing
Set tw = Nothing
With Application
.ScreenUpdating = True
End With
End Sub
It would be appreciated if someone could kindly amend my code