KyleJackMorrison
Board Regular
- Joined
- Dec 3, 2013
- Messages
- 107
- Office Version
- 365
- 2021
- 2019
- Platform
- Windows
Hello,
I would like some help with customising this bit of code below.
What I would like this to do is to prompt the user to select 1 or more .CSV files, and copy the selected range from each file into my main workbook, print that sheet then continue to the next document that was previously select.
The code below does this for only 1 selected document.
Any help would be appreciated.
Kyle
I would like some help with customising this bit of code below.
What I would like this to do is to prompt the user to select 1 or more .CSV files, and copy the selected range from each file into my main workbook, print that sheet then continue to the next document that was previously select.
The code below does this for only 1 selected document.
Any help would be appreciated.
Kyle
VBA Code:
Sub GetFileCopyData()
Application.ScreenUpdating = False
Application.EnableEvents = False
Dim Fname As String
Dim SrcWbk As Workbook
Dim DestWbk As Workbook
Set DestWbk = ThisWorkbook
Fname = Application.GetOpenFilename(FileFilter:="Excel Files (*.csv*), *.csv*", Title:="Select a File")
If Fname = "False" Then
MsgBox "No file was selected", vbInformation
Exit Sub
End If
Set SrcWbk = Workbooks.Open(Fname)
SrcWbk.Sheets(1).Range("B3").Copy DestWbk.Sheets("PASTE").Range("A1")
DestWbk.Sheets("TEMPLATE").printout preview:= False
SrcWbk.Close False
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub