Creating a relative hyperlink

service_impec1 Posted messages 5 Status Member -  
service_impec1 Posted messages 5 Status Member -
Good evening,
I would like to know how to create a relative hyperlink.
Actually, I have an Excel file on my desktop containing a sheet.
To simplify, I'll give you an example:
In cell A2 of my Excel file, I have a line that says "fruit list" and on my USB drive, I have a folder called "Fruits" containing: apples, bananas, oranges.
I want that by clicking on cell A2 of my Excel file on the line "fruit list" present on my desktop, I can directly access the content "apples" present on my USB drive.
The idea is to create a relative hyperlink so that, for example, if I change the location of my Excel file, it won't affect the folder on my USB drive and there won't be any error message.
I hope my explanation is clear. How could I do that? Thank you.
Sincerely

2 answers

eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
 
Hello,

I don’t think you can modify a hyperlink created by insertion. Maybe in VBA?

With the function, and the file in D:\tmp
To address D:\tmp\ccm:
absolute link:
=HYPERLINK("D:\tmp\ccm";"fruits")
relative link:
=HYPERLINK(".\ccm";"fruits")
. points to the directory of the file.

.. points to the parent directory of the file’s directory:
=HYPERLINK("..\ccm";"fruits") is therefore D:\ccm
You can go up multiple directories in the tree with:
..\..\..\ etc

eric

By trying continuously, you eventually succeed.
So the more it fails, the more chances you have that it will work. (the Shadoks)
In addition to the thank you (yes, it’s done!!!), remember to mark it as resolved. Thanks
1
service_impec1 Posted messages 5 Status Member
 
Hello Eric,

Thank you for your help.

To make sure I understood correctly: should I write these formulas in my Excel file or in VBA?

Moreover, I am not a specialist in macros and VBA.

Best regards.
0
eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
 
Hello,

it's a sheet formula.
eric
0
service_impec1 Posted messages 5 Status Member
 
Okay, thanks Eric.

I'll try this in my Excel file and I'll come back here.
0