Did you know that you can use the VBA editor in Excel to navigate your worksheets by using the command button, which is a content control button? Content controls are individual controls that you can add and customize for use in templates, forms, and documents. So, individuals can create a link from the command button to a worksheet in your workbook. In this tutorial, we will explain how to use the Command button to navigate between worksheets in Excel.
How to navigate between Excel worksheets using Command button
Follow the steps below to use the Command button to navigate between worksheets in Microsoft Excel.
- Insert Command button.
- Navigate to worksheet using Command button.
- Navigate to a hidden worksheet.
1] Insert Command button
Launch Microsoft Excel.
On the Developer tab, click the Insert Control button in the Controls group and select the Command button in the Active X Controls section.
Then draw the Command button in the spreadsheet.
Now we want to edit the Command button.
Right-click the Command button, hover the cursor over Commend Button Object, and select Edit from the menu.
2] Navigate to worksheet using Command button
Because the Design Mode is turned on, you can double-click on the command button to open the VBA Editor.
In the VBA Editor window, type the following:
ThisWorkbook.Sheets(“Sheet2”).Activate.
Then click the Exit Design Mode button. See the photo above.
Close the VBA Editor window.
Now click on the command button in the spreadsheet, and it will go to worksheet 2.
3] Navigate to a hidden worksheet
Hide worksheet 2.
Ensure that the Design Mode is turned on. When it is turned on, it is highlighted.
Then double-click the command button to open the VBA Editor.
In the VBA Editor window, type the following:
ThisWorkbook.Sheets(“Sheet2”).Visible = True
ThisWorkbook.Sheets(“Sheet2”). Select
Then click the Exit Design Mode button. See the photo above
Close the VBA Editor window.
Now click on the button in the spreadsheet, and it will go on worksheet 2, which will be no longer be hidden.
How to switch between Worksheets in Excel
You can switch between Excel worksheets: using any one of these methods:
- Using keyboard shortcuts.
- Using the Watch Window.
- Go to any sheet with the Activate Sheet option.
- Using the Name Box.
- Using the Go To dialog box.
- Using Hyperlinks.
- Using VBA Macro.
How do I navigate to another sheet in Excel using the keyboard?
In Microsoft Excel, you can use shortcut keys to navigate between Excel sheets on the keyboard. You can use the shortcut combination keys Ctrl + Up or Ctrl + Down to move to the previous or next sheet in the workbook.
How do you navigate between worksheets in Excel?
In Microsoft Excel, there are several ways you can navigate between worksheets in Excel, such as using shortcut keys, hyperlinks, using the VBA editor. The VBA Editor allows persons to run programs in Excel to perform commands.
Which button should be clicked to run a command?
Once you have inserted your command button, opened the VBA window, and written a code for the command button, you should click the Run button. The Run button allows users to run the codes in the VBA editor to make a command
How does a command button work?
A command button is a control button; users can create a command button to set action by using codes in the VBA Editor. In this tutorial, we have explained how to use the command button in Excel.
READ: How to wrap text in Excel
We hope you understand how to use the command button to navigate between worksheets in Microsoft Excel.