Excel Worksheet Tips: Creating Navigation Buttons
In a previous excel post, I explained how to create hyperlinks. Extending from this, you can link this ability with some simple VBA to create navigation buttons, similar to ones that you would find on websites.
1. Firstly, click on the developer tab.
2. Click on the “Insert” icon. Select “Command Button”.
3. In my introduction to VBA, I mentioned how to create a test macro to determine what code will perform the desired action. In this case, we will open up the second sheet in the workbook. This code is shown below:
Sub Macro1()
Sheets(“Sheet2”).Select
End Sub
This code is then assigned to the button that was created.
4. Right click on the button and select “view code”
5. Once you have clicked on the view code option, between the lines “Private Sub CommandButton1_Click()” and “End Sub” type the name of the macro that switches to sheet 2.
6. Click on the button and it should take you to the second page.
You can create buttons to do a vast array of tasks.
Come check out the directory for the rest of my excel tips!
Submeg
IT