Copying data from one workbook to another workbook

princess21

New Member
Joined
Jun 10, 2011
Messages
15
In Excel I am trying to copy data from a closed workbook stored in a seperate folder location to a master workbook. I am trying to clone the data by selecting set rows from the closed workbbok to the master workbook. I have successfully tested copying select columns of data from one worksheet to another worksheet within the same workbook see code below -

Sub Sheet1tSheet1nsfer()
Sheets("Sheet1").Select
Cells.Find("table1").Offset(1, 0).Select 'finds the cell with the name table1
Do Until ActiveCell.Offset(0, 3) = ""
If ActiveCell <> "" And ActiveCell.Offset(0, 3) <> "m" And ActiveCell.Offset(0, 4) <> "" Then 'if the cell is blank of contains m do not copy over
ActiveCell.Offset(0, 3).Value = "m" 'this step adds an m in column 3 to prevent dulplicate copying over of old data
ActiveCell.Offset(0, 2).Copy
Sheets("Sheet2").Select
NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1 'adds contents to the next available row from the bottom up
Cells(NextRow, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues 'pastes data from column 2 in sheet1 to column 2 of sheet2
Sheets("Sheet1").Select
ActiveCell.Copy
Sheets("Sheet2").Select
Cells(NextRow, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues 'pastes data from column 1 in sheet1 to column 1 of sheet2

Sheets("Sheet1").Select
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Offset(1, 0).Select

End If
Loop
End Sub

How do I implement this technique and expand it to draw data from several workbooks from different folder locations to the master workbook.

P.S As you can see there are other features in this code that I need to maintain. Including a bit that prevents the copying over of duplicate values.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,224,590
Messages
6,179,762
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top