Hello everyone, I am trying to create a series of hyperlinks through a loop without specifying sheet names. This is what I have so far:
<CODE>
Each link spans rows 1 to LastRow and there's a link for each column 1 to j. The code above creates all the links but all the links reference me to Cell(51,1) of the FIRST worksheet. I am lost as to why it is doing that after I specified the worksheet number as j.
<CODE>
Rich (BB code):
Sub Main()
LastCol = ActiveSheet.UsedRange.Columns.Count
LastRow = ActiveSheet.UsedRange.Rows.Count
For j = 2 to LastCol
Worksheets(1).Hyperlinks.Add Anchor:=Range(Cells(1, j), Cells(LastRow, j)), Address:="", SubAddress:=Worksheets(j).Cells(51, 1).Address
Next j
End Sub
</CODE>
Each link spans rows 1 to LastRow and there's a link for each column 1 to j. The code above creates all the links but all the links reference me to Cell(51,1) of the FIRST worksheet. I am lost as to why it is doing that after I specified the worksheet number as j.