I have a macro button that opens up an excel template file, calculates it, saves it to a new location, copies all of the cells & pastes values, and then saves the file again. This is done for about 15 files. My issue is that sometimes when I run the macro button I will find one or two or three files that still have formulas in them and they are not values. It's not the same files that have this issue either. One time when I run it will be the 3rd and 5th files that still have formulas. The next time I run it the 8th file still has formulas. I've had other folks run this macro and so far when they've run it all of the files look good. Is there a setting or something that I need to adjust for this to work on all the files for me?
Here's the code:
Workbooks.Open Filename:="S:\FILE.xlsx", UpdateLinks:=3
ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:="S:\FILE_NEW.xlsx" _
, FileFormat:=xlOpenXMLWorkbook, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Cells.Select
Selection.Copy
Cells.Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("A1").Select
Application.CutCopyMode = False
ActiveWorkbook.Save
ActiveWorkbook.Close
Here's the code:
Workbooks.Open Filename:="S:\FILE.xlsx", UpdateLinks:=3
ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:="S:\FILE_NEW.xlsx" _
, FileFormat:=xlOpenXMLWorkbook, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Cells.Select
Selection.Copy
Cells.Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("A1").Select
Application.CutCopyMode = False
ActiveWorkbook.Save
ActiveWorkbook.Close