How to go back to the previous/last sheet with a shortcut in Excel?


Moving to the previous and last sheet is required when the user wants to search for any data or is willing to understand the data written on the previous and last sheet. Reconciling data from all sheets is good as it allows the user to use the whole data to generate the result. This will make data consistent and accurate. In this article, two examples are provided for the user. The first example is based on the use of VBA code, while the second example is based on the use of Kutool. Using kutool is more efficient and consumes less time. But it can be used with the system that contains the kutool extension, while the VBA code method can be used with all Excel sheets, as there is no need to install any extra plugin.

Example 1: To go to the previous and last sheet in Excel by using the VBA code

Step 1

In this article, users need to open an Excel spreadsheet. In this sheet user just typed the sheet number.

Step 2

To execute the VBA code user need to open the VBA code area. To do so, either press “Alt”+ F11 key combination or click on “Developer” option, and then click on “Visual Basic”.

Step 3

The above step will open a “Microsoft Visual Basic for Applications” dialog box. In the appeared dialog box, click on “Insert” tab and then select the option “Module”.

Step 4

The above step will display a blank coding area for the created module.

Step 5

Click within the code area, and paste the below given code −

' required module definition
Sub GoToPreviousSheet()
   ' declaring variables
   Dim PreviousSheet As Worksheet
   ' setting the data
   Set PreviousSheet = ActiveSheet.Previous
   ' if expression
   If Not PreviousSheet Is Nothing Then
      ' select previous sheet
      PreviousSheet.Select
   ' end of if block
   End If
' end of sub module
End Sub

Snapshot for code area

Step 6

To set the shortcut key for above task, Press “Alt” + Q, to close the current VBA code area, and move back to the sheet. After that go to the “Developer” tab. Under the code section, choose the option “Macros”. The possible key combination for the same is Alt +F8.

Step 7

This will open a “Macro” dialog box, from the list select the method with the name “set_last”, and click on the “Options…” button.

Step 8

This will open a macro options dialog box. In the shortcut key input box, type “J”. finally click on “OK” button.

Step 9

Press “Alt” +Q combination, to go back to the previous sheet. Assume that now user is on “sheet 2”, as shown below −

Now press the key combination “Ctrl+j”. This call will transfer user from the sheet 2 to sheet 1, consider below provided image for reference −

Example 2: To go to the previous and last sheet in Excel by using the kuttools extension

Step 1

For this example, let’s consider the same excel spreadsheet. In this sheet user just typed the sheet number. In the excel sheet, click on “Kutools” option, and under the view section, click on the “Navigation” button.

Step 2

This will display the kutools toolbar on the left side of the page. In the appeared pane, click on the “Expand” button. Consider below provided snapshot for proper reference −

Step 3

This will display the workbook and sheet tab on the left-hand side of sheet. This option pane contains different options for sheet names.

Conclusion

All the provided steps, and explanation are detailed and thorough. By using the provided explanation beginner can also understand the process of moving from last and previous sheet. The provided examples will perform same task. The only difference between them is the ways of implementing it to perform same tasks.

Updated on: 11-May-2023

998 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements