# Microsoft Office Application Help - Excel Help forum > Excel Programming / VBA / Macros >  >  copy and paste entire row in excel using vba

## whycliffrussell

ok. vba newbie...

i want to select and *entire row* in excel in *sheet 1*, and paste the entire row into *sheet 2*. (2 different worksheets in the same workbook)

what code do i need to do this?  :Confused:

----------


## duane

you first need to decide on which row - it could be the active cell row, or you could specify a cell

for the active cell row

sheets("sheet1").activate
activecell.entirerow.copy sheets("sheet2").cells(A,1)

for the specified cell case
sheets("sheet1").activate
Cells(B,C).entirerow.copy sheets("sheet2").cells(A,1)

in both cases, A is the row number on sheet2 where you want to paste it
in the latter case, B is the row number and C is the column number of the cell for the row you want to copy

----------


## whycliffrussell

can i use something like:

rows() to select the row to copy and paste?

----------


## duane

you can either select a cell using the cursor in which it becomes the active cell, or you can specify it in the macro. A third aproach would be if you wanted the last row of data (asuming <60000 rows of data)- then

cells(60000,1).end(xlup).entirerow.copy

----------


## whycliffrussell

thanks. it worked!  :Smilie:

----------

