You did not say whether you wanted a formula or trying to do this with VBA code. Nor which version of MS-Excel is being used.
If you have both the directory path and file name already in a cell, then creating a hyperlink is fairly straight forward.
The HYPERLINK function creates a shortcut or jump that opens a document stored on a network server, an intranet, or the Internet. When you click the cell that contains the HYPERLINK function, MS-Excel opens the file stored at link_location. The syntax for the function is as follows:
HYPERLINK( link_location, friendly_name )
Where "link_location" is the path and file name to the document to be opened as text. The "link_location" can refer to a place in a document — such as a specific cell or named range in an Excel worksheet or workbook, or to a bookmark in a MS-Word document. The path can be to a file stored on a hard disk drive, or the path can be a universal naming convention (UNC) path on a server (in MS-Excel for Windows) or a Uniform Resource Locator (URL) path on the Internet or an intranet.
The "link_location" can be a text string enclosed in quotation marks or a cell that contains the link as a text string.
If the jump specified in "link_location" does not exist or cannot be navigated, an error appears when you click the cell.
The "friendly_name" parameter is the jump text or numeric value that is displayed in the cell. And "friendly_name" is displayed in blue and is underlined. If "friendly_name" is omitted, the cell displays the link_location as the jump text.
The "friendly_name" can be a value, a text string, a name, or a cell that contains the jump text or value.
If "friendly_name" returns an error value (for example, #VALUE!), the cell displays the error instead of the jump text.
To select a cell that has a hyperlink in it without jumping to the hyperlink destination, click the cell and hold the mouse button until the cursor becomes a cross, then release the mouse button.
The following assumes that all of the files are in single folder and the file names are in column D. You could have the hyperlink in column E, using the following formula:
= HYPERLINK( "C:\Users\Pollux\Pictures\" & D3, D3)
The above will display the file name found in cell D3, but would be a direct link to the file itself.
· 10 years ago