it looks for the string \oldpath\ in the hyperlink address and only when it finds it with does the replace
ctrl +mouse over still shows old link or new one ?
if you want to get details :
Sub Hulpeloos()
dim counting,counter as integer
Dim oldtext As String, newtext As String
Dim hl As Hyperlink
counting = 1
counter = 1
oldtext = "\oldpath\"
newtext = "\newpath\"
For Each hl In ActiveSheet.Hyperlinks
If InStr(1, hl.Address, oldtext) Then
''''''''''''''''''''''msgbox hl & " will be changed to : " & Replace(hl.Address, oldtext, newtext) ' remove the ''''''''''' in front to get a pop-up at each change it makes.
hl.Address = Replace(hl.Address, oldtext, newtext)
counter = counter + 1 ' by placing thishere it will count the number of links that have been changed.
End If
counting = counting + 1 'this one counts all the links
Next
msgbox counter & "/" & counting
End Sub
Bookmarks