Macro to change hyperlinks

pzamory

Board Regular
Joined
May 2, 2002
Messages
137
We are moving from the Classic Sharepoint to the new version. All of the files that I had in a Sharepoint directory have been moved to a new Sharepoint directory. The problem is that I have an Excel sheet with over 1,000 hyperlinks that need to be updated.

Can this be done via a macro?

Thanks
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Do you mean something like this?

VBA Code:
Sub ChangeHyperlinkAddress()
    Dim HyperLink As HyperLink
    Dim ws As Worksheet: Set ws = ActiveSheet
    Dim FindThisSTR as string, ReplaceWithThisSTR as String
    
    FindThisSTR = "Old Path To Replace"
    ReplaceWithThisSTR = "New Path To Replace"
    
    on error resume next
       For Each HyperLink In ws.Hyperlinks
            HyperLink.Address = Replace(HyperLink.Address, FindThisSTR, ReplaceWithThisSTR)
        Next HyperLink
    on error goto 0

End Sub

My apologies for any quirks, English is not my native language. "So I blame Google translate for all my goofs." :devilish:
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,253
Members
452,900
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top