Add Method (Hyperlinks Collection)

Applies To

Hyperlinks collection object.

Description

Adds a hyperlink to the specified range or shape. Returns a Hyperlink object.

Syntax

object.Add(Anchor, Address, SubAddress)

object Required. An expression that returns a Hyperlinks object.

Anchor Required Object. The anchor for the hyperlink. Can be either a Range or Shape object.

Address Required String. The address of the hyperlink.

SubAddress Optional Variant. The subaddress of the hyperlink.

Example

This example adds a hyperlink to cell A5.

With Worksheets(1)
    .Hyperlinks.Add Anchor:=.Range("a5"), _
        Address:="http://www.microsoft.com"
End With