PDA

View Full Version : copy data in the last row automatically



grohm
03-26-2007, 05:17 AM
hi guys. this is my first post here and im also pretty new to VBA but im on my way to learn.

my problem is the following. on the first sheet in the file you are supposed to make entries. this entries sum up in the 2nd sheet. now from that sheet some of the data needs to go to a 3rd sheet, which is a list. after that the data in the 2nd sheet can be deleted since its only a temporary "datasave"

the problem is, that this 3rd sheet is a list. the data needs to be added and it needs to keep previous rows of data.

for example: i push the button on sheet 1 and it makes a row of data in sheet 3. after that i enter different data in the first sheet and want that data to be a row below the previous data.

this is keeping me busy for some hours now and i have not found a useable soluion....hope you can help. thx!!!!

Bob Phillips
03-26-2007, 05:36 AM
Find the next usabel row on Sheet 3 with



With Worksheets("Sheet3")
NextFreeRow =.Cells(.Rows.Count,"A").End(xlUp).Row + 1
End With

and then us it like so



Worksheets("Sheet2").Rows(11).Copy _
Worksheets("Sheet3").Range("A" & NextFreeRow)

grohm
03-26-2007, 02:52 PM
Find the next usabel row on Sheet 3 with



With Worksheets("Sheet3")
NextFreeRow =.Cells(.Rows.Count,"A").End(xlUp).Row + 1
End With

and then us it like so



Worksheets("Sheet2").Rows(11).Copy _
Worksheets("Sheet3").Range("A" & NextFreeRow)


thanks for the fast response! but it doesn't work for some case....it does not add the stuff on the 2nd and 3rd page

Simon Lloyd
03-26-2007, 03:21 PM
Bobs suggestion works for what you asked, it copies from sheet 2 and pastes to next useable row on Sheet 3!

Regards,
Simon

lucas
03-26-2007, 03:34 PM
As "Simon says" just change the parts that refer to sheet 2 to refer to sheet 1....

grohm
04-17-2007, 05:54 AM
thanx guys, you were right. it worked perfectly :-)