Share via

Highlight a cell when using hyperlink

Anonymous
2014-10-28T21:51:37+00:00

Hi

i have hyperlinked to a cell on a different worksheet in Excel. i am wondering if i can get the cell to have a different background color or bold text or such when it becomes the active cell.

So if hyperlink goes to Worksheet 2 cell A52, I would like A52 to have the highlight so i can distinguish it from the cells around it.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
  1. Lz365 38,191 Reputation points Volunteer Moderator
    2014-10-28T22:49:49+00:00

    Hi,

    If what you expect is to automatically highlight the destination cell (Sheet2!A52 in your case) when it's reached (selected) after clicking on an hyperlink; then yes that's doable:

    This requires a short macro to force the recalculation of the selected cell. Consequently this will have a cost as the macro will run each time the selection changes...

    CONDITIONAL FORMATTING

    1. Select the target cell (Sheet2!A52 in your case)
    2. Home / Conditional Formatting / New Rule...
    3. Choose Use a formula to determine which cells to format
    4. Enter the formula: =ADDRESS(ROW(),COLUMN())=CELL("address")
    5. Choose your formatting and validate

    MACRO

    1. [Alt]+F11 to open the VBA window
    2. Double-click on Sheet2 under VBAProject...
    3. Copy the following code and paste it into the right part of the VBA window

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

        Target.Calculate

    End Sub

    Finally close the VBA window and test.

    Hope this helps

    Cheers

    Lz.

    50+ people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful