COPY MACRO

P

PCOR

I would like a macro to copy data from sheet 1 to a new book
the macro would copy col A to I inclusive and down to include the last row-
The last row varies all the time...and that is where I am having trouble.
Will someone please help
Thanks
 
J

jase

sub memacro
workbooks.add
thisworkbook.sheets("sheet1").range("A2:I65536").copy
range("A1").pastespecial paste:=xlvalues
end sub

not sure if this will work as I just guessed and typed it
into here without checking first.

You should workout how to do record macros as they are
definately helpfull at getting you started

Jase
 
D

Don Guillett

You should always copy/paste your code to here so we will know you are
making an effort. Please do NOT attach a workbook.
 
D

Don Guillett

One way to get the next available row to use in your macro:

nar=cells(rows.count,"a").end(xldown).row+1

Guillett
alesAid Software
[email protected]
Don Guillett said:
You should always copy/paste your code to here so we will know you are
making an effort. Please do NOT attach a workbook.
 
P

PCOR

Would you please show mw a macro that would do as requested and show that
line
Thanks

Don Guillett said:
One way to get the next available row to use in your macro:

nar=cells(rows.count,"a").end(xldown).row+1

Guillett
alesAid Software
[email protected]
 
P

PCOR

With all due respect...if I had code to cut and paste, I would not be asking
here.
I apperciate your help
 
D

Don Guillett

You didn't indicate that in the OP
The last row varies all the time...and that is where I am having trouble.
indicated that you did have code but were having a problem determining the
last row. Didn't I give you one solution to determine the last row?
try something like this. Modify to suit

nar=worksheets("sheet2").cells(rows.count,"a").end(xldown).row+1
range(cells(activecell.row,"a"),cells(activecell.row,"H")).copy _
worksheets("sheet2").cells(nar,"a")
 
Top