VBA to open multiple Hyperlinks from calculations

Musiclover

New Member
Joined
Jun 6, 2020
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Morning all, hope someone can put me out of my misery.

I have many hyperlink calculations on an excel sheet that link to an external hard drive.

Example: in cell H134 =HYPERLINK("F:\Our Music\"& B134&"\"&C134&"\"&F134&".mp3") where B134 is a band name, C134 is the CD and F134 is the track name.

When I click on it it works fine (although there is a vert annoying harmful file warning) and opens the mp3 file in vlc which is exactly what I want.

Is there a way of opening multiple links at the same time using VBA. I have searched the internet and found a few options but none of them work. Ideally picking the files from various points as opposed to a range, although a range is better than one at a time.various

Thanks for any help you can offer
 

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Musiclover

New Member
Joined
Jun 6, 2020
Messages
7
Office Version
  1. 365
Platform
  1. Windows
I have found a solution that allows me to open a range of cells with hyperlinks in them, is there a way to pick cells rather than only using a range?

Sub followLinks()
Dim c As Range
Dim WorkRng As Range
Dim xTitleId As String
Dim url As String
Dim i As Long

xTitleId = "Select a range to open"
Set WorkRng = Selection
Set WorkRng = Application.InputBox(xTitleId, xTitleId, WorkRng.Address, Type:=8)
If Not WorkRng Is Nothing Then
For Each c In WorkRng
If c.Hyperlinks.Count > 0 Then
For i = 1 To c.Hyperlinks.Count
c.Hyperlinks(i).Follow
Next i
ElseIf InStr(1, c.Formula, "HYPERLINK", vbTextCompare) > 0 Then
If InStr(1, c.Formula, ",") > 0 Then
url = Evaluate(Left(c.Formula, InStr(1, c.Formula, ",") - 1) & ")")
Else
url = c.Value
End If
ActiveWorkbook.FollowHyperlink Address:=url
End If
Next
End If
End Sub


Thanks
 

Watch MrExcel Video

Forum statistics

Threads
1,127,835
Messages
5,627,158
Members
416,224
Latest member
RichardHell

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
Top