Copy the data from one Range to another

     

    Steps Followed:

  • Created Dynamic Array
  • Defined Range Bounds
  • Inserted values into Array
  • Extracted\Copied from Array to worksheet
  • Erase Array
  •  

     

    Click on below mentioned image to watch video:

    Download The Workbook

     

    Sub Copy_Data_From_One_Range_To_Another()

    'Delete Existing Data
    Range("H5").CurrentRegion.ClearContents

    'Declare Array variable
    Dim arr() As Variant

    'Find the Rows Count
    Dim RowsCount As Integer
    RowsCount = Range("B5").CurrentRegion.Rows.Count

    'Find the Columns count
    Dim ColsCount As Integer
    ColsCount = Range("B5").CurrentRegion.Columns.Count

    'Provide The Dimensions to the Array
    ReDim arr(1 To RowsCount, 1 To ColsCount)

    'Insert the Range into the array
    arr = Range(Cells(5, 2), Cells(5 + RowsCount - 1, 2 + ColsCount - 1))

    'Extract The data from Array
    Range(Cells(5, 8), Cells(5 + RowsCount - 1, 8 + ColsCount - 1)) = arr

    'Erase the Array
    Erase arr

    End Sub