patrick2980
New Member
- Joined
- Apr 28, 2020
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Hello,
I am trying to create one macro that will open, close and save files based on file paths specified in a range of cells of the file containing the macro. This is to speed up a weekly process whereby trackers are updated with data from a central master file. I have found the below code which partly works. It opens the files and then saves them. However the issue I have is that it does not save the file in the same folder as where it has opened it from. Instead it saves them in the default local file location in excel. Can anyone advise how I would amend to correct?
Thanks in advance!
Sub Update_Single_Trackers()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For i = 2 To 5
With Workbooks.Open(Range("A" & i), UpdateLinks:=0)
.Save
.Saved = True
.Close 0
End With
Next
Application.ScreenUpdating = True
End Sub
I am trying to create one macro that will open, close and save files based on file paths specified in a range of cells of the file containing the macro. This is to speed up a weekly process whereby trackers are updated with data from a central master file. I have found the below code which partly works. It opens the files and then saves them. However the issue I have is that it does not save the file in the same folder as where it has opened it from. Instead it saves them in the default local file location in excel. Can anyone advise how I would amend to correct?
Thanks in advance!
Sub Update_Single_Trackers()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For i = 2 To 5
With Workbooks.Open(Range("A" & i), UpdateLinks:=0)
.Save
.Saved = True
.Close 0
End With
Next
Application.ScreenUpdating = True
End Sub