Forum Discussion

ML_PT's avatar
ML_PT
Copper Contributor
Jul 20, 2021
Solved

Copy cells to Last Row, Paste to another sheet to Last Row (1rst EMPTY ROW, adding, not replacing)

 

Hello friends. Im New in VBA. Could you help me on this?

 

So, i have  5 Cells D8:H8 with data, in Sheet1
I want to COPY those cells from Sheet1
and paste it to Sheet2, columns A to E in FIRST EMPTY ROW (i mean by adding more data, cause A to E is supposed to have previous data)

Can anyone help? It would be a huge favour for me! THANKS !!

 

ML

  • ML_PT 

    Hi, I use something similar in my day to day work. This should work for your purposes, this functions assuming you have headers on sheet 2.

    Sub Transfer()
    
    LastRow = [Sheet2].Cells(Rows.Count, 1).End(xlUp).Row
    NextRowExport = LastRow + 1
    
        [Sheet1].Range("D8:H8").Copy
        [Sheet2].Range("A" & NextRowExport).PasteSpecial xlPasteValues
        
    End Sub

     

6 Replies

  • DKoontz's avatar
    DKoontz
    Iron Contributor

    ML_PT 

    Hi, I use something similar in my day to day work. This should work for your purposes, this functions assuming you have headers on sheet 2.

    Sub Transfer()
    
    LastRow = [Sheet2].Cells(Rows.Count, 1).End(xlUp).Row
    NextRowExport = LastRow + 1
    
        [Sheet1].Range("D8:H8").Copy
        [Sheet2].Range("A" & NextRowExport).PasteSpecial xlPasteValues
        
    End Sub

     

    • ML_PT's avatar
      ML_PT
      Copper Contributor
      Hi DKoontz,

      First of all thank you for your help.
      I tried your propose but receive an Run-time error 424.
      Thanks for you Help
      • DKoontz's avatar
        DKoontz
        Iron Contributor
        You may have to change the sheet names to match your file. What line is highlighted when the error pops up?

Resources