Looking for Help to Select Cells Containing Hyperlink Text Only

%3CLINGO-SUB%20id%3D%22lingo-sub-1815381%22%20slang%3D%22en-US%22%3ELooking%20for%20Help%20to%20Select%20Cells%20Containing%20Hyperlink%20Text%20Only%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1815381%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20trying%20to%20filter%20cells%20or%20select%20cells%20that%20only%20contain%20hyperlink%20text.%20Is%20there%20an%20easy%20formula%20or%20filter%20feature%20I%20can%20use%20for%20this%3F%20Potentially%20a%20regex%20filter%20example%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20in%20advance!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1815381%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1815722%22%20slang%3D%22en-US%22%3ERe%3A%20Looking%20for%20Help%20to%20Select%20Cells%20Containing%20Hyperlink%20Text%20Only%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1815722%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F844698%22%20target%3D%22_blank%22%3E%40ali3chat%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20might%20use%20this%20macro%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-visual%22%3E%3CCODE%3ESub%20SelectHyperlinks()%0A%20%20%20%20Dim%20wsh%20As%20Worksheet%0A%20%20%20%20Dim%20hyp%20As%20Hyperlink%0A%20%20%20%20Dim%20rng%20As%20Range%0A%20%20%20%20Set%20wsh%20%3D%20ActiveSheet%20'%20or%20specify%20the%20sheet%0A%20%20%20%20For%20Each%20hyp%20In%20wsh.Hyperlinks%0A%20%20%20%20%20%20%20%20If%20rng%20Is%20Nothing%20Then%0A%20%20%20%20%20%20%20%20%20%20%20%20Set%20rng%20%3D%20hyp.Range%0A%20%20%20%20%20%20%20%20Else%0A%20%20%20%20%20%20%20%20%20%20%20%20Set%20rng%20%3D%20Union(rng%2C%20hyp.Range)%0A%20%20%20%20%20%20%20%20End%20If%0A%20%20%20%20Next%20hyp%0A%20%20%20%20If%20rng%20Is%20Nothing%20Then%0A%20%20%20%20%20%20%20%20MsgBox%20%22No%20Hyperlinks%22%2C%20vbInformation%0A%20%20%20%20Else%0A%20%20%20%20%20%20%20%20rng.Select%0A%20%20%20%20End%20If%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

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