# Macro to generate a Hyperlink with known path



## caligirl626 (Dec 26, 2022)

Ok, in this spreadsheet, I need a macro to generate a filepath in column Q which points to a pdf, based on the pdf's filename which will always be the "PO# in column L.pdf" 
Cells Q2, Q4, and Q9 are showing examples of the final filepath, *manually *generated. 

The pdfs are organized into corresponding folders on a network drive, as shown in the file explorer pic (the pic is showing the filepath of cell Q2 in the spreadsheet)
The location will always follow the same pattern: X:\PURCHASING\POs - Received\XXXXXX YYYYYY\XXXXXX.pdf      <--Where XXXXXX is the PO# from column L.    
"YYYYYY" is the only variable, and will change per PO#.  The macro should take that into account.  
The final request would be to Hyperlink Column L to the filepath of column Q
TIA


----------



## HongRu (Dec 26, 2022)

Why not use the function "HyperLink" ?


----------



## caligirl626 (Dec 26, 2022)

HongRu said:


> Why not use the function "HyperLink``


Need the filepath in column Q to be generated first, then hyperlink.   The filepaths shown in column Q were typed in manually.


----------

