OK, for some reason (someone probably knows why) when I use the macro below to add a hyperlink to all cells in one column of a table the loop will reach a value that is just numbers and spit out an error.
the values in the cells are the names of other worksheets in the file. and the values are generated with a loop that changes the values of the cells in one column to the names of the sheets in the workbook. most of the sheet names are a combination of numbers and letters like: "SP1586". the errors come from cells containing names like "601". I dont know why...
so I need help with one of two things, either:
add code to skip errors and highlight the cell that made the error.
OR
eliminate the error by fixing the code, if possible.
the values in the cells are the names of other worksheets in the file. and the values are generated with a loop that changes the values of the cells in one column to the names of the sheets in the workbook. most of the sheet names are a combination of numbers and letters like: "SP1586". the errors come from cells containing names like "601". I dont know why...
so I need help with one of two things, either:
add code to skip errors and highlight the cell that made the error.
OR
eliminate the error by fixing the code, if possible.
Code:
Sub addlink()
ActiveCell.Hyperlinks.Add Anchor:=ActiveCell, Address:="", _
SubAddress:="'" & ActiveCell.Value & "'!A1", TextToDisplay:=ActiveCell.Value
End Sub
Sub looplink()
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 5 To FinalRow
Cells(i, 1).Select
Call addlink
Next i
End Sub