Excel VBA:从另一个工作簿复制行,但只是函数结果
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2175993/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Excel VBA: Copy rows from another workbook, but just the function results
提问by cringe
I want to copy 10 rows from a workbook into a new workbook. The copy & paste is fine, but in the copied cells are some formulas that I need to replace with the results.
我想将工作簿中的 10 行复制到新工作簿中。复制和粘贴很好,但在复制的单元格中有一些我需要用结果替换的公式。
Is there a magical way to copy only the displayed values from the cells?
有没有一种神奇的方法可以只从单元格中复制显示的值?
This is how I do it now:
这就是我现在的做法:
Rows("2:11").Select
Selection.Copy
myWorkbook.Sheets(1).Activate
ActiveSheet.Rows("1:10").Select
ActiveSheet.Paste
回答by GSerg
Rows("2:11").Copy
myWorkbook.WorkSheets(1).Rows("1:10").PasteSpecial xlPasteValues
Application.CutCopyMode = False