Updating links in Excel using Macro

rossnayrtorio

New Member
Joined
Apr 1, 2013
Messages
2
I have created a macro to list all the links in a workbook, and it worked fine. Now I wanted to update it with the link in the second column beside the old link. It looks for example A4:A8 is where the old links are, and B4:B8 is where the new links are. I have written below macro to do what I wanted. However, it will take a while to run the macro and I will have to use task manager to stop it. Please see if I put something wrong with this. Thanks for the help!

Sub ReplaceLinks()
'
' Replace links in this workbook
'
Dim FromText As String
Dim ToText As String

Range("A4").Select

On Error Resume Next
Do
FromText = Activecell.Value​
ToText = ActiveCell.Offset(0, 1).Value​
ActiveWorkbook.ChangeLink Name:=FromText, NewName:=ToText, Type:=xlLinkTypeExcelLinks​
ActiveCell.Offset(1, -1).Select​
Loop Until Activecell = "" Or Activecell.Address = "A8"

End Sub
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,215,035
Messages
6,122,791
Members
449,095
Latest member
m_smith_solihull

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