将数据从源工作表复制到目标工作表的最后一行

时间:2020-03-03 21:55:25

标签: excel vba copy-paste

我想用代码执行字幕任务

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

上面的代码基于线程Copy data from one sheet to the last row of another sheet

但是,我只想将VALUES粘贴到目的地。我应该对上面的代码做什么?

1 个答案:

答案 0 :(得分:0)

替换:

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

具有:

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