logo
search
VBA & Macro Problems

How to Use VBA to Scroll to Excel Hyperlink Destinations

Maira MehtabMaira Mehtab Sep 20, 2026 868 views

Question details

The user needs to use VBA to ensure that clicking hyperlinks to named cells consistently scrolls the destination into view across multiple worksheets.

Product
Microsoft Excel
Device & OS
not provided
Scenario
Navigating a complex workbook containing multiple hyperlinks that point to specific named cells on various worksheets.
Observed behavior
Existing VBA code scrolls correctly for the first clicked destination, but fails to apply the desired scrolling behavior for subsequent hyperlinks clicked on the same worksheet.
Before you start

Ensure that macros are enabled in your workbook settings and that you have identified the named ranges your hyperlinks point to before modifying the VBA code.

Solution 1Recommended

Use Worksheet_FollowHyperlink Event and Application.Goto

Implement the Worksheet_FollowHyperlink event to force the application to scroll to the target cell whenever a hyperlink is clicked.

When dealing with hyperlinks to named ranges, default navigation might not always scroll the target cell into the top-left view, especially for subsequent clicks on the same sheet. By intercepting the hyperlink click event and using Application.Goto with the scroll parameter set to True, you can ensure consistent scrolling behavior.

1
Open the VBA Editor

Press the Alt + F11 keys simultaneously to open the Visual Basic for Applications (VBA) editor.

2
Access the Module

In the Project Explorer pane on the left, double-click the specific worksheet module where your hyperlinks are located. To apply this to the whole workbook, double-click 'ThisWorkbook'.

3
Insert the Event Code

Type or paste the event handler code. For a specific worksheet, use: Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink) Application.Goto Reference:=ActiveCell, Scroll:=True End Sub.

4
Save as Macro-Enabled

Go to File > Save As, and ensure you save your workbook as a Macro-Enabled Workbook (.xlsm) so the script runs correctly next time you open the file.

Global Application: If you want this to apply across all worksheets in the workbook, use the 'Workbook_SheetFollowHyperlink' event inside the 'ThisWorkbook' module instead.
Advanced VBA Support in WPS

Manage Macros and Hyperlinks Effortlessly with WPS Spreadsheet

WPS Spreadsheet offers robust VBA and macro support, allowing you to implement advanced hyperlink scrolling events seamlessly. It provides a familiar developer environment for writing and testing your code.

  1. 1. Open WPS Spreadsheet: Launch WPS Office and open your workbook containing the hyperlinks.
  2. 2. Enable the Developer Tools: Go to the Developer tab on the top ribbon. If it is not visible, enable it from the WPS settings menu.
  3. 3. Open the VBA Editor: Click on the 'Visual Basic' button on the ribbon or press Alt + F11 to open the built-in VBA editor.
  4. 4. Add the Code: Insert your Worksheet_FollowHyperlink script into the appropriate sheet module to enable the scrolling feature, then save the file.
Fully compatible with Microsoft Excel VBA macros and .xlsm file formats.Supports Worksheet_FollowHyperlink events for advanced cell navigation.Intuitive Developer tab for easy macro management and editing.Lightweight software with incredibly fast script execution.
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't Excel automatically scroll to my hyperlink destination?

By default, Excel only activates the target cell. If the cell is already within the visible window area, or if Excel's internal caching skips the scroll on subsequent clicks on the same sheet, it won't force the target to the top-left corner unless explicitly instructed via VBA.

Can I apply this scrolling behavior to the entire workbook at once?

Yes, instead of placing the code in individual worksheet modules, you can use the Workbook_SheetFollowHyperlink event inside the 'ThisWorkbook' module to apply the behavior globally across all sheets.

What does the Scroll:=True parameter do in Application.Goto?

The Scroll parameter, when set to True, forces the application to scroll through the worksheet so that the referenced range (your hyperlink destination) appears exactly at the top-left corner of your document window.