MASS HYPERLINKS TO FILE PATHS

markkuznetsov1

New Member
Joined
Sep 23, 2023
Messages
8
Office Version
  1. 365
Platform
  1. Windows
I have a list of about 10000 parts...each of these parts should have a .pdf file in a folder on my desktop. If I could get the text for the file path in all the cells going down. I.E. "D\parts\PN1000\PN1000.PDF". How can I do a mass change to convert the text value to hyperlinks? I want to quickly scroll through to open the file and see what it is.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
If you want to try something different. This method allows you to just put the Path and File name in a cell and double click the cell to open the file. I don't like Hyperlinks because they change all the time.

The macro below is trying to look at a range called HyperLinkArea. You will need to create that named range to include the cells with the Path\FileName. You can also use to open folders only.

Add this to the Sheet Module level in VBA.
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Dim R As Range
    Dim HyperlinkStr As String
    Dim i As Range
    
    Set R = Range("HyperLinkArea")
    Set i = Intersect(R, Target)
    If Not i Is Nothing Then
      HyperlinkStr = i.Value
      If HyperlinkStr <> "" Then
        Cancel = True
        OpenPathFile HyperlinkStr               'Path, FileName
      End If
    End If
    
    
End Sub

Add this to a Standard VBA Module
VBA Code:
Sub OpenPathFile(PathFile As String)

  Dim PF As Variant
  
  If PathFile = "" Then Exit Sub
  PF = PathFile & vbNullString
  CreateObject("Shell.Application").Open PF
  

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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