Hi guys, I hope you can help me with my code. What I need is ability to pull data from multiple files, either one by one or all at the same time and place it in target file, witch each data going on its own row.
My source file is
Info |
Data |
Info |
Data |
Info |
Data |
My Target files is:
Row 1 |
data |
data |
data |
data |
Row 2 |
data |
data |
data |
data |
Row 3 |
data |
data |
data |
data |
So what I need is when I open a file, it checks, ok there is data already on first row, place the next string of data on the row below. I wrote up the code, but it doesn't seem to work, it just simply keeps over writing the initial row (in my target file the data row stars from 3rd row) and doesn't place anything on the row below. Any help would be greatly appriciated. Here is the code:
Sub Import_Batch_Data()
'''''Define Object for Target Workbook
Dim Target_Workbook As Workbook
Dim Source_Workbook As Workbook
Dim Target_Path As String
Target_Path = Application.GetOpenFilename()
'''''Assign the Workbook File Name along with its Path
'''''Change path of the Target File name
Set Target_Workbook = Workbooks.Open(Target_Path)
Set Source_Workbook = ThisWorkbook
'Ensures the data is put in seperate row
If ActiveCell.Value <> "" Then
ActiveCell.Offset(1, 0).Select
Else
End If
'Data goes onto 3rd row first for each columb
'Column1
Target_Data = Target_Workbook.Sheets(1).Cells(1, 1)
Source_Workbook.Sheets(2).Cells(3, 1) = Target_Data
'Column2
Target_Data = Target_Workbook.Sheets(1).Cells(9, 2)
Source_Workbook.Sheets(2).Cells(3, 2) = Target_Data
'Column3
Target_Data = Target_Workbook.Sheets(1).Cells(8, 2)
Source_Workbook.Sheets(2).Cells(3, 3) = Target_Data
End Sub
Bookmarks