Consulting

Results 1 to 6 of 6

Thread: copy data in the last row automatically

  1. #1

    copy data in the last row automatically

    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!!!!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Find the next usabel row on Sheet 3 with

    [vba]

    With Worksheets("Sheet3")
    NextFreeRow =.Cells(.Rows.Count,"A").End(xlUp).Row + 1
    End With
    [/vba]
    and then us it like so

    [vba]

    Worksheets("Sheet2").Rows(11).Copy _
    Worksheets("Sheet3").Range("A" & NextFreeRow)
    [/vba]

  3. #3
    Quote Originally Posted by xld
    Find the next usabel row on Sheet 3 with

    [vba]

    With Worksheets("Sheet3")
    NextFreeRow =.Cells(.Rows.Count,"A").End(xlUp).Row + 1
    End With
    [/vba]
    and then us it like so

    [vba]

    Worksheets("Sheet2").Rows(11).Copy _
    Worksheets("Sheet3").Range("A" & NextFreeRow)
    [/vba]
    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

  4. #4
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    Bobs suggestion works for what you asked, it copies from sheet 2 and pastes to next useable row on Sheet 3!

    Regards,
    Simon
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

  5. #5
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    As "Simon says" just change the parts that refer to sheet 2 to refer to sheet 1....
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  6. #6
    thanx guys, you were right. it worked perfectly :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •