Update links

WORKING PAPERS: EXCEL & VBA

Occasionally hyperlinks do not update to their new relative file path under the new months folder.

Initial Monthly Process (5-40mins)

  1. Navigate to Sheet
  2. Re-link hyperlink
  3. Repeat for every broken link

New Monthly Process (1min)

  1. Click button

CODE

Sub ReplaceHyperlinks()
Dim xWs As Worksheet
Dim xWss As Sheets
Dim xHyperlink As Hyperlink
Dim xOld As String, xNew As String

Set Ws = Application.ActiveSheet
xOld = Range("PriorFolder")
xNew = Range("CurrentFolder")
Application.ScreenUpdating = False
Set xWss = Application.ActiveWorkbook.Worksheets
For Each xWs In xWss
For Each xHyperlink In xWs.Hyperlinks
xHyperlink.Address = Replace(xHyperlink.Address, xOld, xNew)
Next
Next xWs
Application.ScreenUpdating = True
										
End Sub