ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to paste to last row in another sheet (https://www.excelbanter.com/excel-programming/313736-how-paste-last-row-another-sheet.html)

tango

how to paste to last row in another sheet
 
dear all,
i manage to create header(from header sheet) and details(from detail
sheet) data and paste in final sheet. i face the problem of putting
the last row which is the trailer of the record from trailer sheet.
all i use macro to do it. in the copy and paste what function to use
in macro to identify which is the row immediately after the last
detail row. please help and thanks alot.

1 header
6 detail line
1 trailer
all the below populate in same column which is A


142130091000100Merseng Khung 16102004 (header)
142130091000188112189001123730000005000D.S KRISA A/P D.
142130091000188154022000051140000012025DAVID ANAK PALIT
142130091000188162184000303910000009500ELLY MARINA SAERDG
1421300910001881111111111 0000009900THIS IS TESTING
14213009100018822222222 0000004500THIS IS 2ND
14213009100018833333333 0000034500THIS IS 3RD
HOW TO KNOW THIS IS THE TRAILER (trailer)

yes, first character is number for all 3 components.

Rob van Gelder[_4_]

how to paste to last row in another sheet
 
This will return 7 in your example:

lngLastRow = Sheets("Final").Cells(Rows.Count, 1).End(xlUp).Row


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"tango" wrote in message
om...
dear all,
i manage to create header(from header sheet) and details(from detail
sheet) data and paste in final sheet. i face the problem of putting
the last row which is the trailer of the record from trailer sheet.
all i use macro to do it. in the copy and paste what function to use
in macro to identify which is the row immediately after the last
detail row. please help and thanks alot.

1 header
6 detail line
1 trailer
all the below populate in same column which is A


142130091000100Merseng Khung 16102004 (header)
142130091000188112189001123730000005000D.S KRISA A/P D.
142130091000188154022000051140000012025DAVID ANAK PALIT
142130091000188162184000303910000009500ELLY MARINA SAERDG
1421300910001881111111111 0000009900THIS IS TESTING
14213009100018822222222 0000004500THIS IS 2ND
14213009100018833333333 0000034500THIS IS 3RD
HOW TO KNOW THIS IS THE TRAILER (trailer)

yes, first character is number for all 3 components.




Alan Beban[_2_]

how to paste to last row in another sheet
 
Rob van Gelder wrote:
This will return 7 in your example:

lngLastRow = Sheets("Final").Cells(Rows.Count, 1).End(xlUp).Row


This is the often-suggested, perhaps the most often-suggested, solution;
it is even embodied in purportedly general purpose code at the web site
of Frank Kabel and Bob Phillips. It works for *almost* all cases, but
fails if the last row of the worksheet contains data, probably a rare
occurrence.

Alan Beban

Rob van Gelder[_4_]

how to paste to last row in another sheet
 
Frank and Bob have web sites?


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Alan Beban" wrote in message
...
Rob van Gelder wrote:
This will return 7 in your example:

lngLastRow = Sheets("Final").Cells(Rows.Count, 1).End(xlUp).Row


This is the often-suggested, perhaps the most often-suggested, solution;
it is even embodied in purportedly general purpose code at the web site of
Frank Kabel and Bob Phillips. It works for *almost* all cases, but fails
if the last row of the worksheet contains data, probably a rare
occurrence.

Alan Beban




Tom Ogilvy

how to paste to last row in another sheet
 
One combined site:

http://www.xldynamic.com/source/xld.Rounding.html#vba

as an example or just

http://www.xldynamic.com

--
Regards,
Tom Ogilvy


"Rob van Gelder" wrote in message
...
Frank and Bob have web sites?


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Alan Beban" wrote in message
...
Rob van Gelder wrote:
This will return 7 in your example:

lngLastRow = Sheets("Final").Cells(Rows.Count, 1).End(xlUp).Row


This is the often-suggested, perhaps the most often-suggested, solution;
it is even embodied in purportedly general purpose code at the web site

of
Frank Kabel and Bob Phillips. It works for *almost* all cases, but fails
if the last row of the worksheet contains data, probably a rare
occurrence.

Alan Beban






Rob van Gelder[_4_]

how to paste to last row in another sheet
 
Thanks.

I had been there but never knew who it belonged to.

Cheers

--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Tom Ogilvy" wrote in message
...
One combined site:

http://www.xldynamic.com/source/xld.Rounding.html#vba

as an example or just

http://www.xldynamic.com

--
Regards,
Tom Ogilvy


"Rob van Gelder" wrote in message
...
Frank and Bob have web sites?


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Alan Beban" wrote in message
...
Rob van Gelder wrote:
This will return 7 in your example:

lngLastRow = Sheets("Final").Cells(Rows.Count, 1).End(xlUp).Row


This is the often-suggested, perhaps the most often-suggested,
solution;
it is even embodied in purportedly general purpose code at the web site

of
Frank Kabel and Bob Phillips. It works for *almost* all cases, but
fails
if the last row of the worksheet contains data, probably a rare
occurrence.

Alan Beban









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

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