Help on Add-in for switching between sheets
I added more code for the addin, but still not working. Shortcut key
does not get assigned.
Here is what I have done so far. Thanks for help.
''''''A file named "GoBack.xla"
''''''In Class Modules::EventClass
Public WithEvents App As Application
''''''I put the following section in ThisWorkbook(using workbook
event), it doesn't work
Private Sub App_WorkbookAddinInstall(ByVal Wb As Workbook)
Application.MacroOptions Macro:="ReturnToLastSheet",
HasShortcutKey:=True, ShortcutKey:="Q"
End Sub
Private Sub App_WorkbookOpen(ByVal Wb As Workbook)
OldSheetName = ActiveSheet.Name
End Sub
Private Sub App_SheetDeactivate(ByVal Sh As Object)
OldSheetName = Sh.Name
End Sub
'''''in ThisWorkbook
Dim AppClass As EventClass
Private Sub Workbook_Open()
Set AppClass = New EventClass
Set AppClass.App = Application
End Sub
'in ReturnToLastSheet
'might be wrong but it hasn't come to this far
Sub ReturnToLastSheet()
Worksheets(OldSheetName).Activate
End Sub
|