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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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