If we want to copy and paste, we need to reference the cell here.Assume you are in the cell A1 as shown in the below image. Now we will see different ways of VBA copy and paste values. Range("A1").Value = Range("B3").ValueĮven though this is not a copy and paste method still adds more value to our coding knowledge. The above says whatever the value is there in the cell A1 should be equal to the value in the cell B3.
Look at the below piece of code to understand. Now I will show you one of the alternative ways. One method we have seen is using the VBA copy and paste method. Assume you have the word “Excel VBA” in the cell A1 and you need the same to come in cell B3. We have one more alternative way of having the data from one cell to another cell. ActiveSheet.Paste Alternative Way for using Copy-Paste in VBA In the active workbook, it will select the worksheet “Sheet 2.” ActiveWorkbook.Worksheets("Sheet 2").Select Then it will activate the workbook “Book 2.xlsx”. Workbooks("Book 1.xlsx").Worksheets("Sheet1").Range("A1").CopyĪctiveWorkbook.Worksheets("Sheet 2").Selectįirstly it will copy the data from the worksheet “Sheet1” in the workbook “Book1.xlsx” from the cell A1. But we can also do this from one workbook to another workbook.
We have seen how to copy from worksheet to another worksheet in the same workbook. Worksheets("Sheet1").Range("A1").Copy Destination:=Worksheets("Sheet2").Range("B3")Įnd Sub Example #3 – Copy from One Workbook to another Workbook Destination:=Worksheets("Sheet2").Range("B3") Then in the Destination argument, we need to mention the targeted worksheet name and range of the cell. If we want to copy the data from a particular sheet and want to paste in another particular sheet, we need to mention both the names of the sheets.įirstly we need to mention the copying sheet. Range("A1").Copy Destination:=Worksheets("Sheet2").Range("B3") Now, if we want to copy-paste the value from the different worksheets using VBA macro, then in the Destination argument, we need to reference the sheet name by using the WORKSHEETS object then mention the range of cells in that WORKSHEET. Example #2 – Copy to another Worksheet in the Same Workbook