Copy Data From One Excel Workbook to Another Using Macro

This article will teach you how to copy or transfer data between spreadsheets in Microsoft Excel using VBA. In this particular example, we will also explain how to combine data by using an append query. This combination of tasks will allow you to combine data in existing worksheets for easier analysis.

Macro to Move or Copy Data in Excel

Let's take a case in which you need to copy data from one workbook and then amend the content to another workbook. In this example, workbook one (the source workbook) has 1 2 3 4 5 and workbook two has 6 7 8 9 0.

After running the macro, workbook two should have 6 7 8 9 0 1 2 3 4 5. The formats of both workbooks is the same.

Here is a macro that could transfer and append your data. (Make sure that you read the NOTE in the code):

' ###################### NOTE ################# 'the following lines are to be used of serial number is to be fixed too, instead of being copied ' if there is no need, then delete the line below Workbooks(sBook_t).Sheets(sSheet_t).Range("A" & lMaxRows_t).AutoFill Destination:=Workbooks(sBook_t).Sheets(sSheet_t).Range("A" & lMaxRows_t & ":A" & (lMaxRows_t + lMaxRows_s - 1)), Type:=xlFillSeries End If

CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Related

How to copy data from one excel workbook to another using macro

How to transfer data from one excel workbook to another automatically using macro - Best answers

Copy data from one excel workbook to another using macro - Best answers

This document, titled « Copy Data From One Excel Workbook to Another Using Macro », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).