Forum Discussion

ali3chat's avatar
ali3chat
Copper Contributor
Oct 24, 2020

Looking for Help to Select Cells Containing Hyperlink Text Only

I am trying to filter cells or select cells that only contain hyperlink text. Is there an easy formula or filter feature I can use for this? Potentially a regex filter example?

 

Thank you in advance!

 

1 Reply

  • ali3chat 

    You might use this macro:

    Sub SelectHyperlinks()
        Dim wsh As Worksheet
        Dim hyp As Hyperlink
        Dim rng As Range
        Set wsh = ActiveSheet ' or specify the sheet
        For Each hyp In wsh.Hyperlinks
            If rng Is Nothing Then
                Set rng = hyp.Range
            Else
                Set rng = Union(rng, hyp.Range)
            End If
        Next hyp
        If rng Is Nothing Then
            MsgBox "No Hyperlinks", vbInformation
        Else
            rng.Select
        End If
    End Sub