Create hyperlink using cell data

jcmckeon

New Member
Joined
Nov 4, 2015
Messages
38
Office Version
  1. 365
Platform
  1. Windows
Hello All,

How can I create a hyperlink to a network location from cell data. Want to populate customer name and part number into a link that will go to our network location and find all the folders starting with that part number. It may have a REV number or it may not.

We have hundreds of these so doing it manually is prohibitive. VB scripting is great but I'll take any suggestion. HELP!:confused:

HOW DO I POST FILE and IMAGE for example???

Thank you in advance
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hello All,

How can I create a hyperlink to a network location from cell data. Want to populate customer name and part number into a link that will go to our network location and find all the folders starting with that part number. It may have a REV number or it may not.

We have hundreds of these so doing it manually is prohibitive. VB scripting is great but I'll take any suggestion. HELP!:confused:

HOW DO I POST FILE and IMAGE for example???

Thank you in advance
Hi jcmckeon, welcome to the boards.

First and foremost, yes that can be achieved relatively easily with VBA (depending on how your data is laid out and what you want to incorporate into the hyperlink).

To share a document you should be able to upload to something like One Drive or Dropbox or Google Drive and share the link to the file in a forum post.

To include an image such as a screenshot just click on the "Insert Image" button at the top of the text window here on the forums like this:

50px-Facebook_logo_thumbs_up_like_transparent.png


It will ask you to provide a link to the image and will display whatever image is associated with that link as above. Again, this will mean uploading it somewhere first.
 
Upvote 0
Hello Fishboy, thank you for responding.

Here are the files - image to see what I talking about and a small sample Excel file.

https://www.dropbox.com/sh/wowxvx1m1akbghp/AAAoSeoxjjneJcZVf49flXzoa?dl=0

We have hundreds of files so doing this programmatically will be a BIG HELP.

Thank you in advance.

Jill :eek:
Hi Jill,

Test the following code in a COPY of your workbook. This code is added to a standard module and applied to a button to run. This code assumes that all links will start with the same prefix of \\ds2\data\customer\customer docs\

Rich (BB code):
Sub Build_Hyperlinks()
' Defines variables
Dim Cell, cRange, lRange As Range
' Defines LastRow as last row of column B containing data
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
' Sets check range as B2 to last row of B
    Set cRange = Range("B2:B" & LastRow)
' For each cell in check range
        For Each Cell In cRange
' If cell is not blank then...
            If Cell.Value <> "" Then
' Construct a new value in column M based on the preset path, plus the contents of columns B and E
                Range("M" & Cell.Row).Value = "\\ds2\data\customer\customer docs\" & Cell.Value & "\" & Range("E" & Cell.Row).Value
            End If
' Select column M of cell row
                Range("M" & Cell.Row).Select
' With selection
                    With Selection
' Create hyperlink based on cell value
                        ActiveSheet.Hyperlinks.Add Cell, Cell.Value
                    End With
' Move to next cell in check range
        Next Cell
End Sub
 
Upvote 0
Hi Jill,

Test the following code in a COPY of your workbook. This code is added to a standard module and applied to a button to run. This code assumes that all links will start with the same prefix of \\ds2\data\customer\customer docs\

Rich (BB code):
Sub Build_Hyperlinks()
' Defines variables
Dim Cell, cRange, lRange As Range
' Defines LastRow as last row of column B containing data
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
' Sets check range as B2 to last row of B
    Set cRange = Range("B2:B" & LastRow)
' For each cell in check range
        For Each Cell In cRange
' If cell is not blank then...
            If Cell.Value <> "" Then
' Construct a new value in column M based on the preset path, plus the contents of columns B and E
                Range("M" & Cell.Row).Value = "\\ds2\data\customer\customer docs\" & Cell.Value & "\" & Range("E" & Cell.Row).Value
            End If
' Select column M of cell row
                Range("M" & Cell.Row).Select
' With selection
                    With Selection
' Create hyperlink based on cell value
                        ActiveSheet.Hyperlinks.Add Cell, Cell.Value
                    End With
' Move to next cell in check range
        Next Cell
End Sub

Hi Fishboy, this worked. Now taking it next step - can we take the Customer and Part Number and have it use Windows Explorer to search for the Customer name and part number so that I can get multiple Part number folders. We have several Revisions of the same part number

So referring back to the picture in GoogleDocs - is this possible or are we asking too much from Excel?
 
Upvote 0

Forum statistics

Threads
1,215,737
Messages
6,126,576
Members
449,318
Latest member
Son Raphon

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