Search code examples
excelvbacopy-paste

copy data from source sheet to last row of destination sheet


I would like to carry out the captioned task with the code

Sub COPYTOLASTROW()
Dim LRDest As Long, SrcRng As Range
With Sheets("source")
Set SrcRng = .Range("B16:E20")
End With
With Sheets("summary")
LRDest = .Cells(.Rows.Count, 1).End(xlUp).Row
SrcRng.Copy .Cells(LRDest + 1, 1)
End With
End Sub

The code above was based on the thread Copy data from one sheet to the last row of another sheet.

However, I only want to paste VALUES to destination. What should I do to the code above?


Solution

  • Replace:

    SrcRng.Copy .Cells(LRDest + 1, 1)
    

    with:

    SrcRng.Copy 
    .Range("A" & LRDest + 1).PasteSpecial paste:= xlPasteValues
    Application.CutCopyMode = False