简体   繁体   中英

VBA-code for transition navigation in excel

We are using the transition navigation key (options, advanced) in excel to make sure that when you click on an hyperlink that cell will be "on top of the sheet". However this option is not document specific and each user need to go and click the "transition navigation key" themselves for this to work.

I am very new to vba and still haven't found a way to make it document-specific. I have for example tried:

If Application.TransitionNavigKeys Then 
 keyState = "On" 
Else 
 keyState = "Off" 
End If 

but it doesn't work.

I would be very grateful if anyone has any ideas.

Do you really need the transition navigation key? If you place this code in the WorkBook's code module; when a use clicks a hyperlink the Application will scroll until the ActiveCell is in the top left corner.

Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Hyperlink)

    Application.Goto ActiveCell, True

End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM