Retrieving a hyperlink

ma_nor

New Member
Joined
Mar 20, 2020
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hi All,
Through a formula I am retrieving some informaition from another workbook. That info includes hyperlinks but the formula only retrieves the text but not the hyperlink. Does anyone knows how to retireve the text with the hyperlink?
Thank you
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Hi ma_nor, welcome to the board.
As far as I know this can only be done with an user defined function in VBA. Whenever you are not familiar: open the VB editor with ALT + F11, click in the menu on Insert > Module. In the pane that appears you can paste the code below. Note that you have to save your workbook as an Excel Macro-Enabled Workbook ( .xlsm).
You can use this function in formulas on your worksheet, see attached examples.
VBA Code:
Public Function UrlInfo(argTarget As Range, argProperty As String) As String
    On Error Resume Next
    Select Case LCase(argProperty)
        Case "address"
            UrlInfo = argTarget.Hyperlinks(1).Address
        Case "emailsubject"
            UrlInfo = argTarget.Hyperlinks(1).EmailSubject
        Case "name"
            UrlInfo = argTarget.Hyperlinks(1).Name
        Case "screentip"
            UrlInfo = argTarget.Hyperlinks(1).ScreenTip
        Case "subaddress"
            UrlInfo = argTarget.Hyperlinks(1).SubAddress
        Case "texttodisplay"
            UrlInfo = argTarget.Hyperlinks(1).TextToDisplay
        Case Else
            UrlInfo = "#N/A"
    End Select
End Function

Cell Formulas
RangeFormula
B1B1=UrlInfo(A$1,"Address")
B2B2=UrlInfo(A$1,"ScreenTip")
B3B3=UrlInfo(A$3,"Address")
B4B4=UrlInfo(A$3,"ScreenTip")
B5B5=UrlInfo(A$5,"Address")
B6B6=UrlInfo(A$6,"SubAddress")
 
Upvote 0

Forum statistics

Threads
1,223,920
Messages
6,175,373
Members
452,638
Latest member
Oluwabukunmi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top