kenderweasel
New Member
- Joined
- Feb 17, 2017
- Messages
- 40
Hi,
I'm trying to crate a macro that will import multiple columns of data from a sheet on one workbook into the first empty row on a specific sheet on another. I've written the following code, however, this is currently only copying over the first cell (A2, as the donor sheet has columns). The data that needs to be imported is from columns A-E, and needs to be pasted into A-E on the recieving sheet. Note - once I have this working, I will need to repeat the code for another 8 sheets, which also have data that needs to be imported.
Sub Rectangle1_Click()
Dim OpenFileName As String
Dim wb As Workbook
'Select and Open Workbook
OpenFileName = Application.GetOpenFilename("VoiceID_Reports_,*.xl??")
If OpenFileName = "False" Then Exit Sub
Set wb = Workbooks.Open(OpenFileName)
'Get data
ThisWorkbook.Sheets("Train").Cells(Cells.Rows.Count, 1).End(xlUp).Offset(1, 0).Value = wb.Sheets("TrainSuccess").Range("$A2:$E1000").Value
MsgBox ("Done")
wb.Close
End Sub
I'm trying to crate a macro that will import multiple columns of data from a sheet on one workbook into the first empty row on a specific sheet on another. I've written the following code, however, this is currently only copying over the first cell (A2, as the donor sheet has columns). The data that needs to be imported is from columns A-E, and needs to be pasted into A-E on the recieving sheet. Note - once I have this working, I will need to repeat the code for another 8 sheets, which also have data that needs to be imported.
Sub Rectangle1_Click()
Dim OpenFileName As String
Dim wb As Workbook
'Select and Open Workbook
OpenFileName = Application.GetOpenFilename("VoiceID_Reports_,*.xl??")
If OpenFileName = "False" Then Exit Sub
Set wb = Workbooks.Open(OpenFileName)
'Get data
ThisWorkbook.Sheets("Train").Cells(Cells.Rows.Count, 1).End(xlUp).Offset(1, 0).Value = wb.Sheets("TrainSuccess").Range("$A2:$E1000").Value
MsgBox ("Done")
wb.Close
End Sub