logo
search
VBA & Macro Problems

How to Center a Linked Cell in Excel When Navigating Worksheets

Huda QurayshiHuda Qurayshi Oct 1, 2026 869 views

Question details

The user wants to navigate to another worksheet via a link and have the destination cell automatically centered on the screen.

How to Center a Linked Cell in Excel When Navigating Worksheets
Product
Excel
Device & OS
not provided
Scenario
Clicking a hyperlink to jump to a specific cell on a different worksheet, aiming for an optimal centered view of the target data.
Observed behavior
Standard Excel hyperlinks successfully navigate to the target cell, but they leave the cell at the edge of the screen rather than adjusting the scroll position to center it.
Before you start

Ensure that the Developer tab is enabled in your ribbon and that your workbook is saved as a Macro-Enabled Workbook (.xlsm), as standard hyperlinks cannot control scroll positions.

Solution 1Recommended

Use a VBA Macro to Center the Destination Cell

Since built-in Excel hyperlinks do not adjust the window's scroll view, you must use a VBA macro to navigate to the target cell and manually offset the scroll row and column.

The standard =HYPERLINK() function or Insert Link feature only selects the target cell. To manipulate the view, VBA's ActiveWindow scroll properties are required.

1
Open the VBA Editor

Press Alt + F11 on your keyboard to open the Visual Basic for Applications (VBA) editor.

2
Insert a New Module

In the left-hand Project Explorer pane, right-click your workbook name, choose Insert, and then select Module.

3
Enter the Centering Script

Paste the following script into the module window: Sub GoToCellInCenter() Application.Goto Reference:="Sheet2!B15", Sheets("Sheet2").Select, ActiveWindow.ScrollRow = ActiveCell.Row - (ActiveWindow.Height / 2), ActiveWindow.ScrollColumn = ActiveCell.Column - (ActiveWindow.Width / 2) End Sub. (Note: You may need to adjust the division math depending on your specific row heights and column widths).

4
Create a Macro Button

Return to your worksheet, go to Insert > Shapes, draw a shape to act as your link, right-click it, and choose Assign Macro. Select GoToCellInCenter and click OK.

Use a VBA Macro to Center the Destination Cell
Successful Navigation: Clicking the newly assigned shape will now jump to Sheet2!B15 and force the Excel window to scroll, bringing the selected cell towards the center of your screen.
Free Microsoft Office alternative

Easily Manage VBA Macros with WPS Spreadsheet

WPS Office provides robust, built-in support for VBA macros. You can run scripts to center linked cells exactly as you would in Microsoft Excel, enjoying a smooth, lightweight, and completely compatible spreadsheet experience.

  1. 1. Open Your Macro Workbook in WPS: Launch WPS Spreadsheet and open your existing macro-enabled workbook. Go to the Developer tab to ensure macros are activated.
  2. 2. Access the VBA Editor: Click the 'Visual Basic' icon in the Developer tab or press Alt + F11 to view and modify your centering scripts.
  3. 3. Run the Navigation Script: Use your customized buttons or shapes in the worksheet to trigger the macro, effortlessly jumping to and centering your target linked cells.
Fully compatible with Microsoft Excel formats, including macro-enabled workbooks (.xlsm)Built-in VBA editor for writing, editing, and executing complex macros seamlesslyLightweight architecture ensures fast load times even with script-heavy filesFamiliar ribbon interface requires no steep learning curve
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't the standard HYPERLINK function center the cell?

The HYPERLINK function is strictly designed to select the destination cell or open a file. It does not have access to the application window's scrolling parameters required to physically reposition the screen view.

Do I need to write a separate macro for every single hyperlink?

If you hardcode the destination (like Sheet2!B15), yes. However, you can write a more advanced, dynamic VBA script that reads the target destination from the cell you clicked on, allowing a single macro to handle multiple links.

Can I use the Application.Goto Scroll argument instead?

Yes, you can use Application.Goto Reference:="Sheet2!B15", Scroll:=True. However, this places the destination cell in the top-left corner of the window rather than the center. The ActiveWindow.ScrollRow and ScrollColumn method is required for true centering.