automaticall add hyperlink

kato01

Board Regular
Joined
Sep 9, 2005
Messages
81
Hello,

I am trying to make a list of files in excel. each cell needs to have a hyperlink, so when I click on the cell content it opens the file.
With excel 2003 I used this code:

With ActiveSheet
i = 0
For Each rngCell In .Range("A1:A65530")
i = i + 1
A$ = Cells(i, 2).Value + Cells(i, 1).Value
If Not IsEmpty(rngCell) Then
.Hyperlinks.Add Anchor:=rngCell, _
Address:=A$, TextToDisplay:=rngCell.Value
End If
Next
End With

where Cells(i, 2).Value is a cell that contains the directory where the file is (including the "\") - In excel 2003 the "\" was not included and had to be added.
and Cells(i, 1).Value is the cell that contains the file name
so A$ is the complete link to the file and clicking on the cell would be equivalent to double click on the file in the windows explorer.
I suppose something changed in Excel 2010.

Also is there something magic about the number 65530 ? I know there is a limit of the sheet size, but my file has 71894 rows. Excel 2003 would not load it completely but Excel 2010 did.

Please advise

Thank you
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,224,590
Messages
6,179,763
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top