Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jan Jan is offline
external usenet poster
 
Posts: 159
Default Copy Last row

I'd need to help how to copy last row from a sheet to another


I'm a beginer

Thanks
Jan

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy Last row

Assume we can determine this from column A

Dim rng as Range
With Worksheets("Sheet1")
set rng = .Cells(rows.count,1),End(xlup)
End With
rng.EntireRow.Copy Destination:= _
worksheets("Sheet2").cells(rows.count,1).End(xlup) (2)

this copies the last row of sheet1 to the next empty row in sheet2

--
Regards,
Tom Ogilvy


"Jan" wrote in message
...
I'd need to help how to copy last row from a sheet to another


I'm a beginer

Thanks
Jan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default Copy Last row

Tom

The (2) at the end of your code line:
worksheets("Sheet2").cells(rows.count,1).End(xlup) (2)

seems to have the same effects as: .Offset(1,0)
I'm not familiar with your notation. Can you explain?

thanks

"Tom Ogilvy" wrote:

Assume we can determine this from column A

Dim rng as Range
With Worksheets("Sheet1")
set rng = .Cells(rows.count,1),End(xlup)
End With
rng.EntireRow.Copy Destination:= _
worksheets("Sheet2").cells(rows.count,1).End(xlup) (2)

this copies the last row of sheet1 to the next empty row in sheet2

--
Regards,
Tom Ogilvy


"Jan" wrote in message
...
I'd need to help how to copy last row from a sheet to another


I'm a beginer

Thanks
Jan




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy Last row

Shortcut for Item(2)

? range("A1").Item(2).Address
$A$2

Offset is 0 based, item is 1 based.

--
Regards,
Tom Ogilvy

"gocush" /delete wrote in message
...
Tom

The (2) at the end of your code line:
worksheets("Sheet2").cells(rows.count,1).End(xlup) (2)

seems to have the same effects as: .Offset(1,0)
I'm not familiar with your notation. Can you explain?

thanks

"Tom Ogilvy" wrote:

Assume we can determine this from column A

Dim rng as Range
With Worksheets("Sheet1")
set rng = .Cells(rows.count,1),End(xlup)
End With
rng.EntireRow.Copy Destination:= _
worksheets("Sheet2").cells(rows.count,1).End(xlup) (2)

this copies the last row of sheet1 to the next empty row in sheet2

--
Regards,
Tom Ogilvy


"Jan" wrote in message
...
I'd need to help how to copy last row from a sheet to another


I'm a beginer

Thanks
Jan






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default Copy Last row

with a little experimenting I see that

Range("A1")(2).Select ---will move down (A2)
Selection(2).Select ------- will move down if a single cell or a vert.
range
while
Selection(2).Select -------will move to the right in a horiz range.

these then must be the defaults???



"Tom Ogilvy" wrote:

Shortcut for Item(2)

? range("A1").Item(2).Address
$A$2

Offset is 0 based, item is 1 based.

--
Regards,
Tom Ogilvy

"gocush" /delete wrote in message
...
Tom

The (2) at the end of your code line:
worksheets("Sheet2").cells(rows.count,1).End(xlup) (2)

seems to have the same effects as: .Offset(1,0)
I'm not familiar with your notation. Can you explain?

thanks

"Tom Ogilvy" wrote:

Assume we can determine this from column A

Dim rng as Range
With Worksheets("Sheet1")
set rng = .Cells(rows.count,1),End(xlup)
End With
rng.EntireRow.Copy Destination:= _
worksheets("Sheet2").cells(rows.count,1).End(xlup) (2)

this copies the last row of sheet1 to the next empty row in sheet2

--
Regards,
Tom Ogilvy


"Jan" wrote in message
...
I'd need to help how to copy last row from a sheet to another


I'm a beginer

Thanks
Jan









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy Last row

It moves within the range

and after it exceeds the range, it mimics the same pattern:

Sub Demo1()
For i = 1 To 10
Debug.Print Range("a2:c3")(i).Address, _
Range("A2:c3").Item(i).Address
Next
End Sub

produces:
$A$2 $A$2
$B$2 $B$2
$C$2 $C$2
$A$3 $A$3
$B$3 $B$3
$C$3 $C$3
$A$4 $A$4
$B$4 $B$4
$C$4 $C$4
$A$5 $A$5

--
Regards,
Tom Ogilvy



"gocush" /delete wrote in message
...
with a little experimenting I see that

Range("A1")(2).Select ---will move down (A2)
Selection(2).Select ------- will move down if a single cell or a

vert.
range
while
Selection(2).Select -------will move to the right in a horiz range.

these then must be the defaults???



"Tom Ogilvy" wrote:

Shortcut for Item(2)

? range("A1").Item(2).Address
$A$2

Offset is 0 based, item is 1 based.

--
Regards,
Tom Ogilvy

"gocush" /delete wrote in message
...
Tom

The (2) at the end of your code line:
worksheets("Sheet2").cells(rows.count,1).End(xlup) (2)

seems to have the same effects as: .Offset(1,0)
I'm not familiar with your notation. Can you explain?

thanks

"Tom Ogilvy" wrote:

Assume we can determine this from column A

Dim rng as Range
With Worksheets("Sheet1")
set rng = .Cells(rows.count,1),End(xlup)
End With
rng.EntireRow.Copy Destination:= _
worksheets("Sheet2").cells(rows.count,1).End(xlup) (2)

this copies the last row of sheet1 to the next empty row in sheet2

--
Regards,
Tom Ogilvy


"Jan" wrote in message
...
I'd need to help how to copy last row from a sheet to another


I'm a beginer

Thanks
Jan









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
Copy and paste versus copy and insert copied cells Alana New Users to Excel 1 September 28th 07 08:58 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
EXCEL FILE a copy/a copy/a copy ....filename ve New Users to Excel 1 September 29th 05 09:12 PM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM
How copy format, font, color and border without copy/paste? Michel[_3_] Excel Programming 1 November 5th 03 04:43 PM


All times are GMT +1. The time now is 01:44 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"