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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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