Automatically create static hyperlinks in Excel - without the HYPERLINK function

If you don't want to use the HYPERLINK function in Excel to create links on a spreadsheet, but instead want to automatically add in 'static' hyperlinks that don't rely upon the dynamic information in the function, you can use the below vba code.


Begin with a worksheet like this, with the names to be displayed for the links in one column, and the file paths for the links in the column to the right.





Edit the visual basic code so that the range listing the file paths is listed:



The macro will automatically create hyperlinks in the second column.





Sub CreateHyperlinks()

Dim cl As Range


For Each cl In Range("B2:B3").Cells '## Modify as needed

cl.Hyperlinks.Add cl, cl.Value, , , cl.Offset(0, -1).Value

Next


End Sub