Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

VBA-Excel: Copy/Paste data — Copy the range of data and paste it to another range

In VBA-Excel, Copy and paste the data plays an impor­tant role, we can copy data from one place and paste it at some other place in the same way like how we do it man­u­ally, when you copy some data its goes to the Clip­board from there you can paste it at some other location.

Dim main­work­Book As Workbook

Set main­work­Book = ActiveWorkbook

Copy  the range of data and paste it to another range.

For exam­ple  if you want to copy the data from Range “A1” to “C10” of “Sheet1” and paste it to in “Sheet2”.

For copy the data present in Range “A1” to “C10” from “Sheet1”

mainworkBook.Sheets(“Sheet1”).Range(“A1:C10”).Copy

now the data has been copied to clip­board, you can check it by man­u­ally past­ing it in a notepad.

Now select the cell in which you want to paste the data, in this exam­ple its “B2” in “Sheet2”

mainworkBook.Sheets(“Sheet2”).Range(“A1”).Select

Now paste the data

mainworkBook.Sheets(“Sheet2”).Paste

 

You may also like...

1 Response

  1. Ravi R says:

    Hi,

    I want to copy and paste a table from excel to email. can you guide me how to copy paste a table from excel to email?

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: