Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Copy Variable Range to New Worksheet

Many thanks Jim that's great. On to Phase 2 now!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA help to copy variable range Eduardo Excel Discussion (Misc queries) 7 August 18th 08 09:16 PM
How to Copy and Paste a variable range IK Excel Programming 1 August 29th 06 09:04 PM
Code to copy formula to variable range Snowsride Excel Programming 4 November 3rd 05 09:41 PM
Macro to copy a specified range to a variable range SWT Excel Programming 4 October 21st 05 08:24 PM
Locating variable range to copy Eric C New Users to Excel 3 August 12th 05 10:23 AM


All times are GMT +1. The time now is 04:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"