Is it possible to create a list of hyperlinks in an array, so that the array elements are all hyperlinks?
I am working on a more efficient macro to create a hyperlinked index. I have all of the worksheet names in an array, but would like to convert the array elements to hyperlinks before printing it on my Index tab.
So far I have tried the following (this is just the portion of code where I've tried to turn array elements into hyperlinks)...
Attempt 1:
For Each xElement In xArr
xElement = FormulaR1C1 = "=Hyperlink(""xWB.Sheets(xElement)!A1"", xWB.Sheets(xElement).Name)"
Next xElement
Result for Attempt 1: The macro runs without error, but the resulting list is not hyperlinked. My Index is the same as if I left out this code all together.
Attempt 2:
For Each xElement In xArr
xElement = .Hyperlinks.Add _
anchor:="", _ 'Compile error: Expected: end of statement
Address:="", _
SubAddress:="'" & xWB.Sheets(xelement).Name & "'!A1", _
TextToDisplay:=xWB.Sheets(xelement).Name
Next xElement
Result for Attempt 2: "anchor" is highlighted as causing an error. The error message is "Compile error: Expected: end of statement"
Is it possible to do what I'm attempting?