Last active
April 16, 2017 16:16
-
-
Save ateneva/2471608a739ee7355e5b7d6d34d029a7 to your computer and use it in GitHub Desktop.
Refresh all external connections for a list of workbooks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub RefreshMonthly() | |
Dim Cell As Range | |
Dim Source As String | |
Dim Target As String | |
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
'written by Angelina Teneva, September 2016 | |
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
Application.ScreenUpdating = False | |
Application.DisplayAlerts = False | |
For Each Cell In ThisWorkbook.Worksheets("monthly").Range("A2:A" & Worksheets("monthly").UsedRange.Rows.Count) | |
Source = Cell.Value | |
Target = Cell.Offset(0, 2).Value | |
Workbooks.Open FileName:=Source, ReadOnly:=False, UpdateLinks:=False | |
With ActiveWorkbook | |
.RefreshAll | |
.saveas Target | |
.Close | |
End With | |
Next Cell | |
MsgBox ("Refresh Completed") | |
Application.ScreenUpdating = True | |
Application.DisplayAlerts = True | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment