Skip to main content

Workbook.SheetFollowHyperlink event

Table of contents
  1. Syntax
  2. Parameters
  3. Example

Occurs when you choose any hyperlink in Microsoft Excel. For worksheet-level events, see the FollowHyperlink event.

Syntax

expression.SheetFollowHyperlink (ShTarget)

expression An expression that returns a Workbook object.

Parameters

Name Required/Optional Data type Description
Sh Required Object The Worksheet object that contains the hyperlink.
Target Required Hyperlink The Hyperlink object that represents the destination of the hyperlink.

Example

This example keeps a list, or history, of all the hyperlinks in the current workbook that have been chosen, plus the names of the worksheets that contain these hyperlinks.

Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Hyperlink)
    UserForm1.ListBox1.AddItem Sh.Name & ":" & Target.Address
    UserForm1.Show
End Sub

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>