Hi,
worksheets(sheet1).range(cells(x,1):cells(x,6).copy
worksheets(sheet2).range(cells(y,1),cells(y,6))
is one same line so you have to add an underscore mark :
worksheets(sheet1).range(cells(x,1):cells(x,6).copy _
worksheets(sheet2).range(cells(y,1),cells(y,6))
Regards.
Daniel
-Message
*instead of : you should use , while using cells in range reference*
On Tue, Jun 28, 2011 at 6:12 PM, Ming mingtam...@gmail.com wrote:
Hi all,
I have written below syntax but got an error but I can't figure out
why
worksheets(sheet1).range(cells(x,1):cells(x,6).copy
Thanks Daniel,
Sorry I missed this in the post but actually I wrote this in one line
in the macro, but it doesn't work. The book tells me I shouldn't need
to activate the worksheet by indicating worksheets(XXX) in the code.
I believe I should have interpreted sth wrong, would you please point
Thanks Rakesh,
as I would like to get the copy range changed depending on the
variable I set in the macro. Actually, the code I wrote is something
like below
x = worksheetfunction.counta(worksheets(Sheet1).range(a:a))
worksheets(Sheet1).range(cells(3,1),cells(x,1)).copy
.
.
Sorry I am new