what is the vb code to copy rows from one sheet to another?

B

bxc2739

Can someone please help tell me what is the correct syntax/ie vb code
to copy a entire row from one sheet to another?

Pretend I have two sheets and want to copy an entire row from sheet2
to sheet one , what is the code to do something like this?

I know I can do it manually, but for what I am doing I need
the macro code to do it automatically.

Thanks
 
A

Ardus Petus

If you cant to copy everything (including formats):

Worksheets("Sheet2").Rows(10).Copy _
dest:=Worksheets("Sheet1").rows(10)

To copy values only:
Worksheets("Sheet1").rows(10).value = _
Worksheets("Sheet2").Rows(10).Value

HTH
 
D

Dave Peterson

You gonna be pasting at the bottom of a group of rows???

Can you pick out a column that has data in it if that row is used?

dim myCell as range
dim NextRow as long
dim DestCell as range

with worksheets("sheet1")
set mycell = .range("b72") 'some cell
end with

with worksheets("sheet2")
nextrow = .cells(.rows.count,"G").end(xlup).row + 1
set destcell = .cells(nextrow,"A")
end with

mycell.entirerow.copy _
destination:=destcell
 
Top