到目前为止,我的代码似乎正在运作。唯一的问题是我似乎在复制数组公式而不仅仅是数组公式的值。有没有办法让我现有的代码粘贴特殊(只是值)或者我是否需要一个完整的新方法?
Dim s1 As Excel.Worksheet
Dim destsh As Excel.Worksheet
Dim iLastCelldestsh As Excel.Range
Dim iLastRowS1 As Long
Set s1 = Sheets("RAW - Greenphire")
Set destsh = Sheets("RAW - Concatenated")
'get last row of Q in RAW - Greenphire
iLastRowS1 = s1.Cells(s1.Rows.Count, "Q").End(xlUp).Row
'get last AVAILABLE cell to paste into
Set iLastCelldestsh = destsh.Cells(destsh.Rows.Count, "A").End(xlUp).Offset(1, 0)
'copy into RAW - Concatenated
s1.Range("Q2", s1.Cells(iLastRowS1, "Q")).Copy iLastCelldestsh
答案 0 :(得分:1)
仅在没有剪贴板的情况下传输值。
with s1.Range("Q2", s1.Cells(s1.Rows.Count, "Q").End(xlUp))
destsh.Cells(destsh.Rows.Count, "A").End(xlUp).Offset(1, 0).resize(.rows.count, .columns.count) = .value
end with
答案 1 :(得分:1)
您可以使用PasteSpecial仅粘贴值,如下所示...
s1.Range("Q2", s1.Cells(iLastRowS1, "Q")).Copy
iLastCelldestsh.PasteSpecial xlPasteValues