我正在尝试将值和公式从一个工作簿复制并粘贴到另一个工作簿。有什么方法可以执行此操作而无需单独扫描每个单元格。我研究了特殊粘贴,并意识到它可以将值和公式分开,这是可以理解的,但是有办法做到这两者吗?
我尝试使用.Value,.Value2,并且已阅读.Text不是我所需要的。 我也尝试过做Range()。copy Range()粘贴它,这也不起作用。任何帮助或建议将不胜感激
Sub ImportRange(WB As String, WS As String, RngTo As String, Optional RngFrom As String)
If RngFrom = "" Then
RngFrom = RngTo
End If
Dim i As String
ActiveWorkbook.Worksheets(WS).Range(RngTo) = Workbooks(WB).Worksheets(WS).Range(RngFrom)
'Does nothing
ActiveWorkbook.Worksheets(WS).Range(RngTo).Value = Workbooks(WB).Worksheets(WS).Range(RngFrom).Value
'Does not bring the formula, just leaves new cell blank
ActiveWorkbook.Worksheets(WS).Range(RngTo).Value2 = Workbooks(WB).Worksheets(WS).Range(RngFrom).Value2
' Does not bring the formula, just leaves new cell blank
End Sub