Hi All,
I have a short bit of code, which - to my mind - should work, however I can't get the syntax quite right with the command to add a hyperlink. Basically I want to add 64 hyperlinks on a page, each pointing to a file numbered 1 to 64.xls. I also want to name the cell by doing a VLOOKUP in a table, looking for the same number.
Here's the code...
Can anybody help me sort this out please - the hyperlink.add line fails!
Many thanks indeed!
I have a short bit of code, which - to my mind - should work, however I can't get the syntax quite right with the command to add a hyperlink. Basically I want to add 64 hyperlinks on a page, each pointing to a file numbered 1 to 64.xls. I also want to name the cell by doing a VLOOKUP in a table, looking for the same number.
Here's the code...
Code:
Sub FrontPageNamesAndHyperlinks()
Application.ScreenUpdating = False
Call Variables
n = 0
For i = 6 To 20 Step 2
For j = 4 To 18 Step 2
n = n + 1
k = j
If j = 4 Then
k = 3
End If
Workbooks(MainFile).Sheets("Front Page").Activate
ActiveSheet.Hyperlink.Add Anchor:=Cells(i, k), Address:="" & Path & n & ".xls", TextToDisplay:="=VLOOKUP(" & n & ",'Names Data'!$C$9:$E$72,3,0)"
Next j
Next i
End Sub
Can anybody help me sort this out please - the hyperlink.add line fails!
Many thanks indeed!