ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Variable Range to New Worksheet (https://www.excelbanter.com/excel-programming/394691-copy-variable-range-new-worksheet.html)

nospaminlich

Copy Variable Range to New Worksheet
 
I'm trying to copy a variable range from A1:C ? (the last populated cell in
the range) of Sheet1 to the first available cell in Col A in Sheet 3

I've tried loads of things but none have worked. This is my latest attempt
but I get a Run-time error '424' Object required message....

Dim NextRow As Long
With Worksheets("Sheet3")
NextRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
Set grng = Range("A1:C1" & Range("C65536").End(xlUp).Row)
grng.Copy _
Destination:=Worksheets("Sheet3").Cells(NextRow, "A")
End With


I'd appreciate some help with the code ass I've run out of ideas now.

Many thanks

Jim Thomlinson

Copy Variable Range to New Worksheet
 
with Sheets("Sheet1")
..range(.range("A1"), .cells(rows.count, "C").end(xlup)).copy _
Destination:=Sheets("Sheet3").Cells(rows.count, "A").end(xlup).offset(1, 0)
end with
--
HTH...

Jim Thomlinson


"nospaminlich" wrote:

I'm trying to copy a variable range from A1:C ? (the last populated cell in
the range) of Sheet1 to the first available cell in Col A in Sheet 3

I've tried loads of things but none have worked. This is my latest attempt
but I get a Run-time error '424' Object required message....

Dim NextRow As Long
With Worksheets("Sheet3")
NextRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
Set grng = Range("A1:C1" & Range("C65536").End(xlUp).Row)
grng.Copy _
Destination:=Worksheets("Sheet3").Cells(NextRow, "A")
End With


I'd appreciate some help with the code ass I've run out of ideas now.

Many thanks


nospaminlich

Copy Variable Range to New Worksheet
 
Many thanks Jim that's great. On to Phase 2 now!

Jim Thomlinson

Copy Variable Range to New Worksheet
 
Just so you know you had 2 issues in what you posted...
Set grng = Range("A1:C1" & Range("C65536").End(xlUp).Row)
Is not reference to sheet1 and there should be no 1 after :C
--
HTH...

Jim Thomlinson


"nospaminlich" wrote:

Many thanks Jim that's great. On to Phase 2 now!



All times are GMT +1. The time now is 01:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com