Description:

Copying Data from One Range to Another range is most commonly performed task in Excel VBA programming. We can copy the data, Formats, Formulas or only data from particular range in Excel Workbook to another range or Sheet or Workbook.

This example to show you how to copy data from one Range to another using Excel VBA. This is one of the frequently used codes in the VBA, we often do this activity, copying the data from one range to another range in a worksheet.r

Copy Data from One Range to Another in Excel VBA- Solution(s):

Copy Data from One Range to Another in Excel VBAYou can use Copy method of a range to copy the data from one range to another range.

Copy Data from One Range to Another in Excel VBA – An Example

The following example will show you copying the data from one range to another range in a worksheet using Excel VBA.

Code:
'In this example I am Copying the Data from Range ("A1:B10") to Range(E1")
Sub sbCopyRange()
'Method 1
Range("A1:B10").Copy Destination:=Range("E1")
'Here the first part is source range, 
'and the second part is target range or destination.
'Target can be either one cell or same size of the source range.
'Method 2
Range("A1:B10").Copy
Range("E1").Select
ActiveSheet.Paste
'In the second method, first we copy the source data range
'Then we select the destination range
'Target can be either one cell or same size of the source range.
'Then we paste in the active sheet, so that it will paste from active range
Application.CutCopyMode = False
End Sub
Instructions:
  1. Open an excel workbook
  2. Enter some data in Sheet1 at A1:B10
  3. Press Alt+F11 to open VBA Editor
  4. Insert a Module for Insert Menu
  5. Copy the above code and Paste in the code window
  6. Save the file as macro enabled workbook
  7. Press F5 to run it

Now you should see the required data (from Range A1 to B10 ) is copied to the target range (Range E1 to F10).

Hey! Join Our Community

Get Quick Responses & Experts' Answers in Minutes!
Get Notified - When Answered Your Question!