vba 复制值,没有公式。高级语言
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14981582/
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
COPY VALUES, NO FORMULAS. EXCEL VBA
提问by themolestones
I am writting a code to copy a sheet from one workbook(W1) to another workbook(W2). I know how to do it, but the problem is the copied sheet in W2 still has the formulas and references from W1, and I don't want that I just want the values.
我正在编写代码以将工作簿(W1)中的工作表复制到另一个工作簿(W2)。我知道怎么做,但问题是 W2 中复制的工作表仍然包含来自 W1 的公式和引用,我不希望我只想要这些值。
This is my code to copy the sheet:
这是我复制工作表的代码:
Set W1 = Workbooks("REPORT1.xlsx")
Set W2 = Workbooks("REPORT2.xlsx")
W1.Sheets("TEST").Copy After:=W2.Sheets(wb.Sheets.Count)
Any thoughts. Thanks
有什么想法吗。谢谢
回答by Ripster
Set W1 = Workbooks("REPORT1.xlsx")
Set W2 = Workbooks("REPORT2.xlsx")
W1.Sheets("TEST").Copy After:=W2.Sheets(wb.Sheets.Count)
ActiveSheet.UsedRange.Value = ActiveSheet.UsedRange.Value