View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
muster muster is offline
external usenet poster
 
Posts: 25
Default Help on Add-in for switching between sheets

I wrote a macro to switch between 2 sheets, works well for my file.

I'd like to use it for any workbook and distribute it in the office. I
saved the code below as an addin and copy it to ...\Library, then chose
it on Tools\Add-ins, but nothing happens, can't find it anywhere.

I'd like to assign the macro to a shortcut or a button (ideally
ctrl+tab) so I can use it. Thanks.

'in Module1
Public OldSheetName As String

Sub ReturnToLastSheet()
Worksheets(OldSheetName).Activate
End Sub

'in ThisWorkbook
Private Sub Workbook_Open()
OldSheetName = ActiveSheet.Name
End Sub

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
OldSheetName = Sh.Name
End Sub

***

Furthermore, if people like it, I may want to make it intall and assign
shortcut automatically, but have no idea how to do that yet, any hints?