+ Reply to Thread
Results 1 to 5 of 5

Copy and Paste Row from Sheet(1) to First Empty Row in Sheet(2)

Hybrid View

  1. #1
    Registered User
    Join Date
    04-30-2010
    Location
    washington dc
    MS-Off Ver
    Excel 2007
    Posts
    51

    Copy and Paste Row from Sheet(1) to First Empty Row in Sheet(2)

    Hi -

    I am looking for a macro which will copy data from B6:R6 from Sheet1, and paste this data to the first available (empty) row in Sheet2, same columns: B:R. Thus, every time I enter new data on Sheet1 and run the macro, the new data will be added to the first empty row in Sheet2.

    Any help would be greatly appreciated!

  2. #2
    Registered User
    Join Date
    10-13-2012
    Location
    Carrollton, TX
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: Copy and Paste Row from Sheet(1) to First Empty Row in Sheet(2)

    Try the below code:

    Dim FirstBlankCell As Range
    
        Sheets("Sheet1").Select
        Range("b6:r6").Select
        Selection.Copy
        Sheets("Sheet2").Select
        Set FirstBlankCell = Range("a" & Rows.Count).End(xlUp).Offset(1, 0)
        FirstBlankCell.Activate
        Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
            , SkipBlanks:=False, Transpose:=False
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        
    On Error GoTo 0
        Set FirstBlankCell = Nothing
        End Sub

  3. #3
    Registered User
    Join Date
    04-30-2010
    Location
    washington dc
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: Copy and Paste Row from Sheet(1) to First Empty Row in Sheet(2)

    Hi gujugof -

    Operationally it works perfectly. Any way to add a line which then deletes the text (while leaving the formating alone) from the range b6:r6 on sheet1 once the data has been copied to sheet 2?

  4. #4
    Registered User
    Join Date
    10-13-2012
    Location
    Carrollton, TX
    MS-Off Ver
    Excel 2007
    Posts
    28

    Re: Copy and Paste Row from Sheet(1) to First Empty Row in Sheet(2)

    You can add the following and see if that works.

    Sheets("Sheet1").select
    activesheet.range("b6:r6).clearcontents

  5. #5
    Registered User
    Join Date
    04-30-2010
    Location
    washington dc
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: Copy and Paste Row from Sheet(1) to First Empty Row in Sheet(2)

    Thanks gujugolf. Works perfect!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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