ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   hyperlink file via macro? (https://www.excelbanter.com/excel-programming/292841-re-hyperlink-file-via-macro.html)

Cesar Zapata[_2_]

hyperlink file via macro?
 
Try this. change to suit your needs.

Dim cell As Range

For Each cell In Selection

ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="C:\testt\" &
cell.Value _
, TextToDisplay:=cell.Value
Next cell

End Sub



Chao

Cesar



"Lobo" wrote in message
...
Hi all,

I have a spreadsheet with a column of files

example:
Column A
Row 1 asdf.doc
Row 2 zxcv.xls
Row 3 qwer.doc

is there a way to make it so that If i click on a cell, that it will

automatically go to that file on the system?

I have 3 directories that the files can be possibly stored on based on

their type.
Lets say that my workbook is test.xls and it is located in C:\test.xls.
I have three files located in three directories
C:/directory1/asdf.doc
C:/directory2/zxcv.xls
C:/directory3/qwer.doc

I need to beable to click on a cell
for instance clicking on A1 which contains the text "asdf.doc"
and the macro will automatically search the 3 directories for asdf.doc and

then open the file.

Is this possible? Any help would be grand.

-Lobo




Lobo[_2_]

hyperlink file via macro?
 
thanks, it work

i have to try change it as needed hehe


All times are GMT +1. The time now is 11:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com