+ Reply to Thread
Results 1 to 6 of 6

Paste rows to a new worksheet in the next available row

  1. #1
    Registered User
    Join Date
    01-03-2012
    Location
    Utah
    MS-Off Ver
    Excel 2007
    Posts
    3

    Post Paste rows to a new worksheet in the next available row

    I am new at this but want to use a macro to paste a row to the next available row on another worksheet. I do not understand code but was wondering if this could be done when recording a macro. Any help would be apreciated. I am working in excel 2007
    Last edited by Srbills; 01-04-2012 at 11:25 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Paste rows to a new worksheet in the next available row

    If you record the macro, the next time you run it, it will paste the data in the exact same row as the previous run. You can do this through VBA coding.
    for e.g.
    Please Login or Register  to view this content.
    This will copy row 2 (from A to G) from Sheet1 into sheet 2 in the next available row.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    01-03-2012
    Location
    Utah
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Paste rows to a new worksheet in the next available row

    Below is the macro as I have it. Could you show me what needs to be changed to make it paste to the next available row in the DATA worksheet. Everything works fine up until it pastes to the next available row in the DATA worksheet.

    Sheets("Report").Select
    Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
    xlNone, SkipBlanks:=False, Transpose:=False
    Sheets("COLLECTION").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("DATA").Select
    Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
    xlNone, SkipBlanks:=False, Transpose:=False
    Last edited by Srbills; 01-03-2012 at 02:35 PM.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Paste rows to a new worksheet in the next available row

    Your code seems incomplete in places. For example. It says -
    Please Login or Register  to view this content.
    but its not showing what it is copying.
    Also, you do not need to use .select in codes. You can directly copy like how i gave the example above.

    One more thing, the code example i gave in post 2 will not work for paste special. In that case, you can alter the example as
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-03-2012
    Location
    Utah
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Paste rows to a new worksheet in the next available row

    That works except that I would like it to end leaving the DATA worksheet in view instead of the COLLECTION worksheet. The code is below if you could tell me what to change.

    Sheets("Report").Select
    Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
    xlNone, SkipBlanks:=False, Transpose:=False
    Sheets("COLLECTION").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("DATA").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValuesAndNumberFormats

    End Sub

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Paste rows to a new worksheet in the next available row

    Since you would like to continue with your style of coding, you just need to add a line at the end (before End Sub)
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1