Macro to Change the source path for all several links

Snake Eyes

Board Regular
Joined
Dec 14, 2010
Messages
105
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a workbook that has several (cell) references to cells in other workbooks. I would like to find a way, via macro, to change the path to the cells in the other workbooks.

I use this code to change hyperlinks but now I need code to update individual cell references. The path to be changed is the same.

Code:
Sub Reset_HL_Path()
    Dim hl As Hyperlink
    For Each hl In ActiveSheet.Hyperlinks
        hl.Address = Replace(hl.Address, "C:\Users\username\Application Data\Microsoft\Excel\", "G:\Data Files\Company Name\Expense Reports\")
    Next
End Sub

Thanks
Snake Eyes
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Doesn't a normal Ctrl-H Replace action suffice? (perhaps in the full workbook rather than sheet by sheet).
 
Upvote 0

Forum statistics

Threads
1,224,561
Messages
6,179,521
Members
452,923
Latest member
JackiG

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