Change Hyperlinks

something68

New Member
Joined
Sep 13, 2024
Messages
27
Office Version
  1. 365
Platform
  1. Windows
I moved excel spreadsheets from OneDrive to S:Drive and I want to change their hyperlinks on an excel sheet that I have in U:Drive. How do I change the hyperlinks all at once?
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Provided all the hyperlinks are the same, try this:

VBA Code:
Sub ChangeHyperlinks()

Dim Cell As Range
Dim ws As Worksheet
Dim hl As Hyperlink

For Each ws In ThisWorkbook.Worksheets
    For Each Cell In ws.UsedRange
        If Cell.Hyperlinks.Count > 0 Then
            For Each hl In Cell.Hyperlinks
                If hl.Address = "C:\Users\AAA\OneDrive\Documents" Then ' insert old address
                    hl.Address = "U:\" 'insert new address
                End If
            Next hl
        End If
    Next Cell
Next ws

End Sub
 
Upvote 0
Provided all the hyperlinks are the same, try this:

VBA Code:
Sub ChangeHyperlinks()

Dim Cell As Range
Dim ws As Worksheet
Dim hl As Hyperlink

For Each ws In ThisWorkbook.Worksheets
    For Each Cell In ws.UsedRange
        If Cell.Hyperlinks.Count > 0 Then
            For Each hl In Cell.Hyperlinks
                If hl.Address = "C:\Users\AAA\OneDrive\Documents" Then ' insert old address
                    hl.Address = "U:\" 'insert new address
                End If
            Next hl
        End If
    Next Cell
Next ws

End Sub
 
Upvote 0
I have no idea what to change, etc. on what you provided so I will simply change the link to each name as I work on their worksheet.

Thanks.
 
Upvote 0
You would just need to change the folder addresses in quotes in the following bit of code. The first line you put the address (the dummy address is in quotes) you currently have in the workbook, and the second line is the address (the dummy address is in quotes) you want to replace it with. Again, this is only if all the hyperlinks are the same. If they're not, describe exactly what you changed with the existing hyperlinks.

VBA Code:
                If hl.Address = "C:\Users\AAA\OneDrive\Documents" Then ' insert old address
                    hl.Address = "U:\" 'insert new address
 
Upvote 0
This is still not helpful to me and still confusing. I tried it and I'm feeling it's taking more time to try things than it is to change them as I work on them. I recall someone I work with helped me before but they transferred and I don't know if I'd be able to remember what he helped me with for him to help again.

Thank you.
 
Upvote 0
Are you simply wanting to change the drive letter from "S" to "U" and keep everything else the same?
 
Upvote 0
I have a list of employees on the U:Drive. On the S:Drive, I have their Record of Absence. I would like to be on the U:Drive and click on their name to bring up their "personal" ROA but it won't open since I moved from C:Drive (then deleted from) to S:Drive.

I do not understand that VBA code and I also noticed that the option to edit links in the data tab is not available. I thought I'd be able to click and highlight the column of employee names to change/update the drive.
 
Upvote 0
I am not quite sure I understand that you are saying.

Can you just show us how the hyperlinks need to be updated, in plain English?
Maybe show us an example?
 
Upvote 0
And where do I find the hyperlinks? See, this is turning into way too much work. I will just update the links individually as I work on them. It will take a bit longer, but it's the only other way.

Thank you.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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