Thread: Workbook Links
View Single Post
  #4   Report Post  
JMB
 
Posts: n/a
Default

Here's another macro that will find all external links in the workbook.


Sub FindLink()
Dim Report As Object
Set Report = Sheets.Add
Dim LinkList As Variant
Dim LinkPath As Variant

LinkList = ActiveWorkbook.LinkSources(xlExcelLinks)
If Not IsEmpty(LinkList) Then
For i = 1 To UBound(LinkList)
LinkPath = Split(LinkList(i), "\", -1, vbTextCompare)
For Each x In Worksheets
If x.Name < Report.Name Then
For Each y In x.UsedRange
If InStr(1, y.Formula, LinkPath(UBound(LinkPath)), vbTextCompare) 0
Then
Report.Select
ActiveCell.Value = x.Name & y.Address
ActiveCell.Offset(0, 1).Value = LinkList(i)
ActiveCell.Offset(1, 0).Select
End If
Next y
End If
Next x
Next i
End If

End Sub


"Jim" wrote:

I would like to simply find which cells in my spreadsheet have links to
another workbook. What can I do to identify the address of cells that have
links to an external workbook. Thanks, Jim