Be the first user to complete this post

  • 0
Add to List

VBA-Excel: Copy/Paste data - Copy the Entire row data and paste it to another row

In VBA-Excel, Copy and paste the data plays an important role, we can copy data from one place and paste it at some other place in the same way like how we do it manually, and when you copy some data its goes to the Clipboard from there you can paste it at some other location.

Dim mainworkBook As Workbook

Set mainworkBook = ActiveWorkbook

Copy the Entire row data and paste it to another row.

For example  if you want to copy the data from row 5 of “Sheet1” and paste it to in “Sheet2”.

For copy the data present in row 5 from “Sheet1”

mainworkBook.Sheets("Sheet1").Rows(5).EntireRow.Copy

now the data has been copied to clipboard, you can check it by manually pasting it in a notepad.

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

mainworkBook.Sheets("Sheet2").Range("A1").Select

Now paste the data

mainworkBook.Sheets("Sheet2").Paste



Also Read:

  1. VBA-Excel: Create Dynamic or Run-time WorkSheets using Macro.
  2. VBA-Excel: Fill Excel Range Values in a 2D Array
  3. VBA-Excel: SUDOKU Solver
  4. VBA-Excel: Copy/Paste data - Copy the range of data and paste it to another range
  5. VBA-Excel: Add Worksheets For All The Given Dates Except Weekends and Copy The Common Template In Each Worksheet