Excel – How to overcome the limit of hyperlinks in Excel

excelhyperlinkvba

I have a list of links in more than 100000 cells.

Example

I have to give hyperlinks to all of them but in Excel there is a limit of 66530 hyperlinks per worksheet.

How can I overcome the limit or how can I merge cells with equal values using VBA?

Sub AddHyperlinks()

    Dim myRange As Range
    Set myRange = Range("A1")
    Dim hText As Variant

    Do Until IsEmpty(myRange)

        hText = Application.VLookup(myRange.Value, Worksheets("Sheet2").Range("A:B"), 2, False)

        If IsError(hText) Then
            hText = ""
        Else
            ActiveSheet.Hyperlinks.Add Anchor:=myRange, Address:="http://" + hText, TextToDisplay:=myRange.Text
            hText = ""
        End If

        Set myRange = myRange.Offset(1, 0)
    Loop

End Sub

Best Answer

The solution is as mentioned by @Rory: Use the HYPERLINK function in your cell to emulate a hyperlink via a formula.

=HYPERLINK(url, displaytext)

This effectively bypasses the built-in Excel limit on "hard-coded" hyperlinks. Just tested this out after I hit the infamous error 1004:

Application-defined or object-defined error

when trying to create 100k+ hyperlinks in a sheet.