复制和特殊粘贴,值与VBA

我到目前为止的代码似乎正在工作。 唯一的问题是,我似乎在复制数组公式的值而不是数组公式。 有没有办法让我现有的代码粘贴特殊(只是值)还是我需要一个新的方法完全?

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 

仅在没有剪贴板的情况下传输值。

 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 

你可以使用PasteSpecial来粘贴下面的值。

 s1.Range("Q2", s1.Cells(iLastRowS1, "Q")).Copy iLastCelldestsh.PasteSpecial xlPasteValues