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

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

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