Excel 2016 在 VBA PasteSpecial 上失败
Excel 2016 fails on VBA PasteSpecial
此 VBA 代码是 运行 在 Excel 2013 上(在多台不同的机器上):
Sub CopyStaticData()
Application.ScreenUpdating = False
Sheets("Data Input").Range("Input_Station_ID").Copy
Sheets("Data Received").Range("Data_Station_ID").PasteSpecial Paste:=xlPasteValues
...
但是,在 Excel 2016 年,它在最后一行抛出运行时错误:
Error 1004: Method 'PasteSpecial' of object 'Range' failed
我尝试用其显式代码 (-4163) 替换 xlPasteValues - 但无济于事。
有什么想法吗?可能是 Microsoft 兼容性问题?
仅用于粘贴值,我建议不要使用副本。
相反,简化为 RangeB.value = RangeA.value
。
更简单,更快,没有棘手的剪贴板,写在一小行中。
此 VBA 代码是 运行 在 Excel 2013 上(在多台不同的机器上):
Sub CopyStaticData()
Application.ScreenUpdating = False
Sheets("Data Input").Range("Input_Station_ID").Copy
Sheets("Data Received").Range("Data_Station_ID").PasteSpecial Paste:=xlPasteValues
...
但是,在 Excel 2016 年,它在最后一行抛出运行时错误:
Error 1004: Method 'PasteSpecial' of object 'Range' failed
我尝试用其显式代码 (-4163) 替换 xlPasteValues - 但无济于事。
有什么想法吗?可能是 Microsoft 兼容性问题?
仅用于粘贴值,我建议不要使用副本。
相反,简化为 RangeB.value = RangeA.value
。
更简单,更快,没有棘手的剪贴板,写在一小行中。