I am trying to create a VBA script that copies all data in a whole workbook as pastes as values, then saves as a new workbook, thus removing all formulas.
Here is my code:
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
I'm getting a runtime error 1004 on the .PasteSpecial xlValues command but I can't work out why.
How can I accomplish the goal of pasting all data as values and saving as a new workbook?