Macros and Hyperlinks

steve case

Well-known Member
Joined
Apr 10, 2002
Messages
823
I have a hyperlink in Cell A4 [ =HYPERLINK(B4,E4) ] I can click on it and it opens the webpage just fine.
I would like to have a macro open the web page but I am having no luck trying to figure out from Microsoft Visual Basic Help how to do that.

It's interesting, hyperlinks copied directly in from the web like the one I have in Cell J4 opens with a macro I recorded just as nicely as you please:

Code:
Range("J4").Select
    Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
But change that to:

Code:
Range("A4").Select
    Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=False
in order to open my formula generated link, and it crashes.

So I need help
 
Corrected code
Code:
Sub Convert_To_Hyperlinks()
    Dim Cell As Range
    For Each Cell In Range("B4", Range("B" & Rows.Count).End(xlUp))
        If Not IsEmpty(Cell) Then
            ActiveSheet.Hyperlinks.Add Anchor:=Cell.Offset(, -1), _
                                        Address:=Cell.Value, _
                                        ScreenTip:=Cell.Offset(, 3).Value, _
                                        TextToDisplay:=Cell.Offset(, 3).Value

        End If
    Next Cell
End Sub

Fantastic!

You know, that's a couple hundred dollars worth of information, and I get it for free here. What a fantastic site (-:

Oh, yes, it worked.
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,224,830
Messages
6,181,225
Members
453,025
Latest member
Hannah_Pham93

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