Consulting

Results 1 to 8 of 8

Thread: Solved: Copy all data on Sheet 1 to the latest blank row of sheet 2

  1. #1
    VBAX Mentor
    Joined
    Feb 2012
    Posts
    406
    Location

    Question Solved: Copy all data on Sheet 1 to the latest blank row of sheet 2

    I want copy all data on Sheet 1 to the latest blank filed of sheet 2 .

    Could you please help me with VBA code for this subject .

    Thank you very much .

  2. #2
    VBAX Expert CatDaddy's Avatar
    Joined
    Jun 2011
    Posts
    581
    Location
    [VBA]Sheets(1).Range("A1").UsedRange.Copy Destination:=Sheets(2).Range("A" & Sheets(2).Range("A" & Rows.Count).End(xlup).Row + 1)[/VBA]
    ------------------------------------------------
    Happy Coding my friends

  3. #3
    VBAX Mentor
    Joined
    Feb 2012
    Posts
    406
    Location
    Dear CatDaddy

    Thank you but it is not work , give me error

    Run-Time error '438':

  4. #4
    VBAX Mentor
    Joined
    Feb 2012
    Posts
    406
    Location
    I found it

    [VBA]
    'Get last row of data
    lastrowSrc = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row

    'Get first blank row (last row of data +1)
    lastrowDest = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row + 1

    'Copy row
    Sheets("Sheet1").Range("A1:E" & lastrowSrc).EntireRow.Copy Sheets("Sheet2").Range("A" & lastrowDest)


    [/VBA]

  5. #5
    VBAX Expert CatDaddy's Avatar
    Joined
    Jun 2011
    Posts
    581
    Location
    [VBA]Sheets(2).Range("A1").CurrentRegion.Copy Destination:=Sheets(1).Range("A" & Sheets(1).Range("A" & Rows.Count).End(xlUp).Row)[/VBA]

    my bad
    ------------------------------------------------
    Happy Coding my friends

  6. #6
    VBAX Mentor
    Joined
    Feb 2012
    Posts
    406
    Location
    Thank you

  7. #7
    VBAX Expert CatDaddy's Avatar
    Joined
    Jun 2011
    Posts
    581
    Location
    no problem my friend
    ------------------------------------------------
    Happy Coding my friends

  8. #8
    Very nice!

Posting Permissions

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