please can you write for me an excel module that if I call from a sheet will take me…
Jump to turn (6)
- 1please can you write for me an excel module that if I call from a sheet will tak
- 2When I call the module all I get is the message 'No previous sheet to navigate b
- 3Th VBA code you provided did not work when I called it from a button nor did it
- 4It works when I call it from a Button but is still does not work when I call it
- 5Using the code you have provided, it works perfectly when I call it from a butto
- 6When I include 'ThisWorkbook.PreviousSheetNum = Me.Index' I get the error Method
- User
please can you write for me an excel module that if I call from a sheet will take me back to the last sheet that was open.
- Assistant
Here is an Excel VBA module that you can call from a sheet to navigate back to the last sheet that was open:
VBAPrivate LastSheet As String Sub GoToLastSheet() If LastSheet <> "" Then Sheets(LastSheet).Activate Else MsgBox "No previous sheet to navigate back to.", vbExclamation End If End Sub Private Sub Workbook_SheetDeactivate(ByVal Sh As Object) LastSheet = Sh.Name End Sub Private Sub Workbook_SheetActivate(ByVal Sh As Object) LastSheet = Sh.Name End Sub