I need a macro to run through the excel files in the parent folder, change the formulas to values (select all, copy, paste special: values) and save. I've tried altering existing code others have used but get all different errors. Can someone help?
[font=Verdana][color=darkblue]Option[/color] [color=darkblue]Explicit[/color]
[color=darkblue]Sub[/color] test()
[color=darkblue]Dim[/color] strPath [color=darkblue]As[/color] [color=darkblue]String[/color]
[color=darkblue]Dim[/color] strFile [color=darkblue]As[/color] [color=darkblue]String[/color]
[color=darkblue]Dim[/color] wkb [color=darkblue]As[/color] Workbook
[color=darkblue]Dim[/color] wks [color=darkblue]As[/color] Worksheet
strPath = "C:\Path\" [color=green]'Change the path to your folder[/color]
[color=darkblue]If[/color] Right(strPath, 1) <> "\" [color=darkblue]Then[/color] strPath = strPath & "\"
strFile = Dir(strPath & "*.xls")
[color=darkblue]Do[/color] [color=darkblue]While[/color] Len(strFile) > 0
[color=darkblue]Set[/color] wkb = Workbooks.Open(strPath & strFile)
[color=darkblue]For[/color] [color=darkblue]Each[/color] wks [color=darkblue]In[/color] wkb.Worksheets
[color=darkblue]With[/color] wks.UsedRange
.Copy
.PasteSpecial xlPasteValues
[color=darkblue]End[/color] [color=darkblue]With[/color]
[color=darkblue]Next[/color] wks
wkb.Close savechanges:=[color=darkblue]True[/color]
strFile = Dir
[color=darkblue]Loop[/color]
MsgBox "Completed...", vbInformation
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[/font]
Try...
[/CODE]