Replacing Multiple Hyperlink Values in a List

I rather embarrassed of this solution, but I’m hoping that if I post what I’m doing some else out there will know of a better way.


I have a long list with hyperlinks. I reuse this list in multiple locations and need to change the location name in the URL. I export the list to a spreadsheet and launch the Visual Basic editor. I then run the following code:


Sub ReplaceHyperlinkAdresses()

Dim hypLink As Hyperlink

Dim ws As Worksheet


For Each ws In Worksheets

For Each hypLink In ws.Hyperlinks

If hypLink.Address Like “http://server/sites/department/Documents/Forms/OLDLOCATION.aspx*” Then

hypLink.Address = _

Replace(hypLink.Address, “http://server/sites/department/Documents/Forms/OLDLOCATION.aspx“, “http://server/sites/department/Documents/Forms/NEWLOCATION.aspx“)

End If

Next hypLink

Next ws

End Sub


Afterwards, I copy and paste the column with the hyperlinks back into my list using the datasheet view. It works, but I feel like there should be a better way to update a list of hyperlinks in a SharePoint list.



2 Responses to Replacing Multiple Hyperlink Values in a List

  1. Esther says:

    Please publish in your website, if there is any way to copy list items from a sharepoint site in one server and a sharepoint site in another server.

  2. Esther,

    I would say it depends. Is this a one-time copy or do you need to keep these lists synchronized? If they need to be synchronized, is it one-way (one is the master) or two-way (both lists could have changes)?

    For a one-time copy, assuming you have the rights to do this, I would go into the list settings and (under Permissions and Management) Save list as template – making sure to check the box to copy include content. Once that is done you can go into the List Template Gallery, and save the .stp file locally. The on the other server, you will add that list to the Template Gallery and then when you create list, you should see it as one of the options under Custom Lists.

    If you don’t have the rights to do all this template and settings steps, your other option might be to (under Actions) Export to Spreadsheet and on the other server Create > Custom Lists > Import Spreadsheet.

    Let me know if this answers your question or we can talk about how to do the more complicated scenarios.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: