0
我試圖創建一個VBA腳本,將整個工作簿中的所有數據複製爲值粘貼,然後另存爲新工作簿,從而刪除所有公式。複製所有值VBA腳本失敗
這裏是我的代碼:
Sub MakeAllVals()
Dim wSheet As Worksheet
For Each wSheet In Worksheets
With wSheet
.UsedRange.Copy
.PasteSpecial xlValues
End With
Next wSheet
Application.Dialogs(xlDialogSaveAs).Show
End Sub
我在.PasteSpecial xlValues命令得到一個運行時錯誤1004,但我不明白爲什麼。
我該如何實現將所有數據粘貼爲值並保存爲新工作簿的目標?
可能重複的:http://stackoverflow.com/questions/20671795/how-to-remove-formulas-from-sheet-but-keep-their-calculated-values – 2014-10-27 12:20:18