View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default How to obtain Cell Address and/or Select all sheet-cells with xlEx

I'd try something like this:

Option Explicit

Sub TestLinks()
Dim myHyperlink As Excel.Hyperlink
Dim myRange As Excel.Range

Set myRange = Nothing

Debug.print ActiveSheet.Hyperlinks.Count

For Each myHyperlink In ActiveSheet.Hyperlinks
Debug.Print myHyperlink.Parent.Address
If myRange Is Nothing Then
Set myRange = myHyperlink.Parent
Else
Set myRange = Union(myRange, myHyperlink.Parent)
End If
Next myHyperlink

If Not myRange Is Nothing Then
myRange.Select
End If


End Sub


" wrote:

2003, 2007


With the code below as a base point: Is there a way to obtain

1) Obtain the address of and/or
2) Select all cells with links?

Sub OpenAllLinks()
Dim arLinks As Variant
Dim intIndex As Integer
arLinks = ActiveWorkbook.LinkSources(xlExcelLinks)

If Not IsEmpty(arLinks) Then
For intIndex = LBound(arLinks) To UBound(arLinks)
ActiveWorkbook.OpenLinks arLinks(intIndex)
Next intIndex
Else
MsgBox "The active workbook contains no external links."
End If

End Sub


TIA EagleOne