Open Multiple Hyperlinks

How_Do_I

Well-known Member
Joined
Oct 23, 2009
Messages
1,831
Office Version
  1. 2010
Platform
  1. Windows
Hello all, I have a workbook that contains multiple hyperlinks in a column... I've looked online but none of the VBA code that I've found will open my links... An ideas please?

A working hyperlink from my workbook is: "=HYPERLINK(INDEX(List!B:B,MATCH(D11,List!C:C,0)),D11)"

As I mentioned, on this particular worksheet all the hyperlinks are in the same column and all the hyperlinks open .pdf files...
 
VBA Code:
Sub Test_Open_Link()
Dim WorkRng As Range
Set WorkRng = Application.InputBox(prompt:="Range", Type:=8)
For Each iCell In WorkRng.Cells
If Not IsEmpty(iCell) Then
ThisWorkbook.FollowHyperlink iCell.Value
End If
Next iCell
End Sub

Above is the code for the inputbox.


If you would like to open the path in visible cells only, Insert another blank sheet into your workbook and paste the following code modifying the sheet numbers to get the desired outcome.

VBA Code:
Sub Test_Open_Link_With_Filter()
Sheet3.Range("a1:A1000").Copy '  <---   This is the sheet and range that contains your full filepath
Sheet2.Range("A2:A100").SpecialCells(xlCellTypeVisible).PasteSpecial xlValues '\   <---
For Each iCell In Sheet2.Range("A1:A1000") '                             <---    - These two are the empty sheet that you will be using as a pawn.
If Not IsEmpty(iCell) Then
ThisWorkbook.FollowHyperlink iCell.Value
End If
Next iCell
End Sub
 
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
You could also do something like:

VBA Code:
Sub Test_Open_Link_With_Filter()
For Each iCell In Selection
If Not IsEmpty(iCell) Then
ThisWorkbook.FollowHyperlink iCell.Value
End If
Next iCell
End Sub

This will open the file paths that you have selected before running the macro.
 
Upvote 0
Do you want to use an inputbox, or is that an attempt to work around the filtered cells?

Thanks Cowen... There's another post that is similar to this... I've altered my approach whereby I apply manual filters to get the files I wish to open, copy those to another page with VBA and open those as multiple hyperlinks... That way the filtered cells aren't an issue...
 
Upvote 0
That is what the second bit of code on post #11 is doing.
 
Upvote 0
COwen… I'm confused... Am I only using your code in post #11 or does post # 12 change post # 11... Also in the second part of post # 11 do I just use the range where all the unfiltered file paths are listed in my workbook...?
 
Upvote 0
Between posts #11 and #12, there are three separate solutions to your problem. The first in #11 uses the inputbox principle. The second in #11 copy's all of the cells in the specified range and then pastes only the ones that do not have a filter applied into a blank sheet then opens the links. The code in #12 opens the links in the cells which are selected when you run the macro.

You will only use ONE of the above solutions!!!

I can only help you with code if you make up your mind as to what you want. You may have a clear understanding of what you do want, if this is the case, then disregard the previous sentence, if that is no the case, then pay close attention to the next sentence. You need to communicate that clearly.
 
Upvote 0

Forum statistics

Threads
1,214,896
Messages
6,122,132
Members
449,066
Latest member
Andyg666

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