COPY MACRO

  • Thread starter Thread starter PCOR
  • Start date Start date
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
 
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
 
You should always copy/paste your code to here so we will know you are
making an effort. Please do NOT attach a workbook.
 
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
(e-mail address removed)
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.
 
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
(e-mail address removed)
 
With all due respect...if I had code to cut and paste, I would not be asking
here.
I apperciate your help
 
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")
 
Back
Top