A useful routine to select all the cells within a worksheet which contain hyperlinks.
' -------------------------------------------------------------------------------- ' Copyright ©1999-2018, Shyam Pillai, All Rights Reserved. ' -------------------------------------------------------------------------------- ' You are free to use this code within your own applications, add-ins, ' documents etc but you are expressly forbidden from selling or ' otherwise distributing this source code without prior consent. ' This includes both posting free demo projects made from this ' code as well as reproducing the code in text or html format. ' -------------------------------------------------------------------------------- Sub SelectAllHyperlinkCells() Dim LinkRange As Range Dim Link As Hyperlink Dim IsFirstCellInRange As Boolean IsFirstCellInRange = True If ActiveSheet.Hyperlinks.Count > 0 Then
For Each Link In ActiveSheet.Hyperlinks If IsFirstCellInRange = True Then Set LinkRange = Link.Range IsFirstCellInRange = False
Else Set LinkRange = Application.Union(LinkRange, Link.Range)
End If
Next Link LinkRange.Select
End If End Sub
|