Hi,
I'm using the following code to merge all worksheets of the two workbooks to one new workbook.
The formulas in the new document still link to the previous (unmerged) documents.
Is there a way this can be solved by adding some code?
The formula links must link to the data in the new (merged) document. I've been browsing the forum but I didn't find a solution for this.
Thanks in advance for your assistance!
Best regards,
Wim
I'm using the following code to merge all worksheets of the two workbooks to one new workbook.
The formulas in the new document still link to the previous (unmerged) documents.
Is there a way this can be solved by adding some code?
The formula links must link to the data in the new (merged) document. I've been browsing the forum but I didn't find a solution for this.
Thanks in advance for your assistance!
Best regards,
Wim
Code:
Sub CombineFiles()
Dim Path As String
Dim FileName As String
Dim Wkb As Workbook
Dim Ws As Worksheet
Application.EnableEvents = False
Application.ScreenUpdating = False
Path = "I:\Kader\Rapporteringen\Coachingsdocumenten\samenvoegen"
FileName = Dir(Path & "\*.xls", vbNormal)
Do Until FileName = ""
Set Wkb = Workbooks.Open(FileName:=Path & "\" & FileName)
For Each Ws In Wkb.Worksheets
Ws.Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
Next Ws
Wkb.Close False
FileName = Dir()
Loop
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub