Macro to change hyperlinks

pzamory

Board Regular
Joined
May 2, 2002
Messages
135
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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
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,215,200
Messages
6,123,611
Members
449,109
Latest member
Sebas8956

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