Can I tell a macro to open a hyperlink?

steve case

Well-known Member
Joined
Apr 10, 2002
Messages
823
I have hyperlinks down column A If I click on any one of them, they work.

I would like a macro to select any one of those cells and open the web page.

Is this possible?
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
With an Active hyperlink in Cell A5
In your VBA Macro this will Open it...

Code:
Sub Foo()
Range("A5").Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End Sub
 
Upvote 0
With an Active hyperlink in Cell A5
In your VBA Macro this will Open it...

Code:
Sub Foo()
Range("A5").Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End Sub


Jim, Thanks. I'm rusty at macros & VBA but I'll try your solution to verify that it works, than this:

Code:
Sub mymacro ()
(a bunch of stuff before arriving at the chosen active cell)
...
ActiveCell.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End Sub

If that doesn't work, I'll flail around a bit before I come back for more help (-:
 
Upvote 0
Steve... Sounds like you are on the right TRACK!! Good Luck. But do write back, if there is a problem. Jim
 
Upvote 0
Steve... Sounds like you are on the right TRACK!! Good Luck. But do write back, if there is a problem. Jim

I had asked this very question a few years and my earlier search didn't find it
but a new search did here it is Link so I will review that, Uh I hear the dinner
bell so it will wait until tomorrow. I got it done in 2010 I should manage to get
it done today.

Thanks for your help.
 
Upvote 0
I got a nastygram from the Mods:

duplicate thread

This post has a time stamp of 1:06 and my earlier post was at 10:39.
After no response I paged down to see if it was there, it didn't show up,
I figured I forgot to press submit. I've been having trouble on other blogs
with posts being delayed or not showing up and sometimes I do forget to
press submit.
 
Upvote 0
Steve... Sounds like you are on the right TRACK!! Good Luck. But do write back, if there is a problem. Jim

I picked this up after a month and tried to make it work. Here's my code:

Code:
Sub PasteSpecialTransposeValues()
'
' PasteSpecialTransposeValues Macro
' My Data
'
' Keyboard Shortcut: Ctrl+q
'
[Do Some Stuff]
    Sheets("Sheet5").Select
    ActiveCell.Offset(0, 12).Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
    ActiveCell.Offset(1, -12).Select
    Sheets("Sheet1").Select
[Do some more stuff]    
    Sheets("Sheet5").Select
    ActiveCell.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End Sub

It stops after selecting [Sheet5] and says:
Run Time Error 9:
Subscript out of range

The active cell should be one cell down from where it had been on [Sheet 5] where I want it to find the hyperlink and open it - in the same window by the way. If I click on the hyperlink manually which is the step I'm trying to remove, it opens a new window which is a pain because I have to stop and delete a series of new windows every so often.

Some background:

My data looks like this:
1234; 6955;N;000
1235; 6920;N;000
1236; 6854;N;000
1237; 6874;N;000
etc.

I do some stuff to it on [Sheet1] to get the following

6955
6920
6854
6874
etc.

Which gets a paste Special on [Page5]

I then want Excel to open the Next hyperlink listed in [ColumnA] [Sheet5] Where I manually [Ctrl"A"][Ctrl"C"][Alt Tab] back to Excel and activate my macro, [PasteSpecialTransposeValues] via an assigned button and then "Rinse & Repeat" over 1,000 times.

So the fewer keystrokes the better.

Oh, I have Excel 2007
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
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