how to paste to last row in another sheet

  • Thread starter Thread starter tango
  • Start date Start date
T

tango

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.
 
This will return 7 in your example:

lngLastRow = Sheets("Final").Cells(Rows.Count, 1).End(xlUp).Row
 
Rob said:
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
 
Thanks.

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

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top