vba excel application.onkey
1 TopicMac OS Excel vba error Run-time error 91 . Object variable or With block variable not set
MacOS High Sierra 10.13.6 MS Office Excel for Mac 365 16.27 VBA 7.1 I would like to assign a {F11} to run a sub for all worksheets. I can't even get it to work for the current worksheet. Should I be able to do this? Option Explicit Dim WithEvents App As Application Private Sub App_WorkbookOpen(ByVal wb As Workbook) App.OnKey "{F11}", "HyperAdd1" End Sub Sub HyperAdd1() Dim rng As Range Dim WorkRng As Range On Error Resume Next Set WorkRng = Application.Selection For Each rng In WorkRng Application.ActiveSheet.Hyperlinks.Add rng, rng.Value Next End Sub I've tried other events, auto_open, Private Sub App_SheetActivate(ByVal Sh As Object), Private Sub workbook_open() Thanks for any help. Milton5.4KViews0likes1Comment