Hi there,
Does anyone know of a keyboard short cut or maybe a bit of VBA that allows you to move between the worksheet you are on and the last worksheet you were on within a workbook? I have a couple of workbooks with a lot of tabs and this would be a really handy feature to have.
Alan
Hello Alan,
All I know of is the standard shortcuts to use Ctrl + PgUp/PgDown to move up/down the range of sheets. If there are many sheets I right click the navigation arrows on bottom left to get a pop-up window of all the sheets.
Br,
Anders
Thanks for the reply Anders - there does not seem to be a feature for this yet - I do see some VBA based solutions on the web - I will give them a go.
Alan
Hi Alan,
Here is a VBA solution.
1. In ThisWorkbook, you paste the following two codes.
The first code allows you to initialize the shortcut keys with the main macro 'Select_Last_Sheet'.
For the example, I have chosen the following combination : CTRL + ALT + J
Private Sub Workbook_Open()
LastSheet = ActiveSheet.Name
Application.OnKey "^%j", "Select_Last"
End Sub
The second code retrieves the name of the last sheet
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
LastSheet = Sh.Name
End Sub
2. Then, you create a module in which you put this code. It allows you to teleport to the desired tab.
Public LastSheet As String
Sub Select_Last_Sheet()
Application.Sheets(LastSheet).Select
End Sub
Info : the table below gives an overview of the syntax to be used. There are many others.
Key | Key code |
Capital | + |
Control | ^ |
Alt | % |
Suppr | {DELETE} |
Backspace | {BACKSPACE} |
BR,
Lionel