Opening Selected Hyperlink DISPLAYING TEXT in Default Browser in MS Excel

0 votes

I solved a portion of my issue and used Excel to open hyperlinks in a number of chosen cells. However, it only functioned if the hyperlink was visible and not covered by "friendly text."

Everything works perfectly and the hyperlinks (URLs) open in the default browser when I use the code below to select cells with hyperlinks (URLs). I want to be able to click on hyperlinks that have "friendly text" displayed on them. =HYPERLINK("http://jsvp/MoveImage.aspx?t=1&sku="&A13,A4). The cells display the word "upload" in this manner.

=IF(LEN(A3)>5,"",HYPERLINK("https://supercms.company.com/ManageProducts/"&LEFT(A3,5),A3)) This displays a value from Cell A3.

I get a Run-time error '-2147221014 (800401ea)' I Cannot open the specified file. 

Would there be a way to open the URLs even if the text was hiding the Hyperlink (URL)?

Credit to: PETER ALBERT (https://stackoverflow.com/users/1867581/peter-albert?tab=profile) for his code.

Sub Open_SelectedTextlinks()
    Dim c As Range

    If Not TypeOf Selection Is Range Then Exit Sub
    For Each c In Selection.Cells
        If c.Hyperlinks.Count = 0 Then
            ActiveSheet.Hyperlinks.Add Anchor:=c, _
                Address:="http://" & c.Value 'Depending on the content of your cell, remove the "http://" & part
        End If
        c.Hyperlinks(1).Follow
    Next
End Sub
Oct 7, 2022 in Others by Kithuzzz
• 38,020 points
684 views

1 answer to this question.

0 votes

Try this code:

  Sub Open_SelectedTextlinks()
If Not TypeOf Selection Is Range Then Exit Sub
For Each c In Selection.Cells
    If c.Hyperlinks.Count = 0 Then

With Worksheets(1)
 .Hyperlinks.Add Anchor:=.Range("a5"), _
 Address:="https://example.microsoft.com", _
 ScreenTip:="Microsoft Web Site", _
 TextToDisplay:="Microsoft"
  Range("A5").Select
    Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End With
    End If
Next

End Sub
answered Oct 7, 2022 by narikkadan
• 63,720 points

Related Questions In Others

0 votes
1 answer

How to open .xlsx files in MS Excel from VS Code?

Hello, to open xlxs files, or files ...READ MORE

answered Feb 17, 2022 in Others by gaurav
• 23,260 points
3,943 views
0 votes
1 answer

SharePoint - Excel Online - Edit in Excel and Edit in Browser multiple users

Here is the Microsoft article regarding co-authoring https://support.office.com/en-us/article/Collaborate-on-Excel-workbooks-at-the-same-time-with-co-authoring-7152aa8b-b791-414c-a3bb-3024e46fb104?ui=en-US&rs=en-US&ad=US When ...READ MORE

answered Oct 3, 2022 in Others by narikkadan
• 63,720 points
1,193 views
0 votes
1 answer

In Excel, how to find a average from selected cells

If one has the dynamic array formula ...READ MORE

answered Oct 9, 2022 in Others by narikkadan
• 63,720 points
706 views
0 votes
1 answer

Excel formula for searching two text in one cell and return values based on the result

You can include a second IF within ...READ MORE

answered Oct 10, 2022 in Others by narikkadan
• 63,720 points
1,167 views
0 votes
1 answer

Extracting info from hyperlink

This will offer you an example of ...READ MORE

answered Feb 2, 2023 in Others by narikkadan
• 63,720 points
322 views
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 26,740 points
1,112 views
0 votes
1 answer

How to load file to Excel Power query from SFTP site

Currently, I don't think there is a ...READ MORE

answered Dec 3, 2018 in Power BI by Upasana
• 8,620 points
3,544 views
0 votes
1 answer

Using VBA Excel to create a gramatically correct list

The Excel AND function is a logical ...READ MORE

answered Feb 9, 2022 in Others by gaurav
• 23,260 points
829 views
0 votes
1 answer

Create a hyperlink to a sheet with same name as the value in the selected cell in Excel through VBA

Credit to Spectral Instance who found the ...READ MORE

answered Feb 6, 2023 in Others by narikkadan
• 63,720 points
855 views
0 votes
1 answer

Split text cells in 70 character chunks in Excel

You can do this using Power Query Data ...READ MORE

answered Oct 2, 2022 in Others by narikkadan
• 63,720 points
781 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP