At the moment im using a vba module to save a worksheet as a seperate file.
After it saves the file it changes every formula into its own values because of ws.[A1].PasteSpecial Paste:=xlValues.
I tried changing this to xlFormulas but it will refer every formula to the first worksheet.
This is the code I'm using down below (This is code I found elsewhere, it works for me but Id like to make it so that it will copy the formulas in the Sheet without it referring to the first Sheet like =ALS(Test.xlsm!Tabel3[@BEDRAG]="";"";Test.xlsm!Tabel3[@BEDRAG])
Sub xslxSaver()
Dim NewName As String
Dim nm As Name
Dim ws As Worksheet
Dim wsA As Worksheet
Dim strName As String
Set wsA = Worksheets("Klanten")
If MsgBox("Copy specific sheets to a new workbook" & vbCr & _
"New sheets will be pasted as values, named ranges removed" _
, vbYesNo, "NewCopy") = vbNo Then Exit Sub
With Application
.ScreenUpdating = False
On Error GoTo ErrCatcher
Sheets(Array("Factuurblad")).Copy
On Error GoTo 0
' Paste sheets as values
' Remove External Links, Hperlinks and hard-code formulas
' Make sure A1 is selected on all sheets
For Each ws In ActiveWorkbook.Worksheets
ws.Cells.Copy
ws.[A1].PasteSpecial Paste:=xlValues
ws.Cells.Hyperlinks.Delete
Application.CutCopyMode = False
Cells(1, 1).Select
ws.Activate
Next ws
Cells(1, 1).Select
' Remove named ranges
For Each nm In ActiveWorkbook.Names
Next nm
strName = wsA.Range("XslxNaam").Value
' Input box to name new file
NewName = InputBox("Please Specify the name of your new workbook", "New Copy", strName)
On Error GoTo ErrCatcher
' Save it with the NewName and in the same directory as original
ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & NewName & ".xlsx", FileFormat:=51
ActiveWorkbook.Close SaveChanges:=False
.ScreenUpdating = True
End With
Exit Sub
ErrCatcher:
MsgBox "Specified sheets do not exist within this workbook"
End Sub