View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
sebastienm sebastienm is offline
external usenet poster
 
Posts: 694
Default Change all Links

Hi,
using a loop, something like:
Dim OldLink, NewLink As String
Dim wsInput As Worksheet
Dim i as long

Set wsInput = ThisWorkbook.Worksheets("Input")
for i =11 to 47
OldLinks = wsInput.Range("E" & i).Value
NewLink = wsInput.Range("C" & i).Value
ThisWorkbook.ChangeLink Name:=OldLink, NewName:=NewLink,
Type:=xlExcelLinks
Next i
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"shorticake" wrote:

Each month I have to change the links in my workbook. I've listed the paths
of the current links in cells E11:E47, and what I want the paths of the new
links to be in cells C11:C47. How can I change the code below so that it will
change all the links in the correct order for example, E11 to C11, E12 to
C12, and so on?

Thanks in advance!

Sub ChangeLink()

Dim OldLink, NewLink As String
Dim wsInput As Worksheet
Set wsInput = ThisWorkbook.Worksheets("Input")

OldLinks = wsInput.Range("E15").Value
NewLink = wsInput.Range("C15").Value
ThisWorkbook.ChangeLink Name:=OldLink, NewName:=NewLink, Type:=xlExcelLinks

End Sub