Skip to main content
Updated date:

How to Create a Button in Microsoft Excel That Opens a Calculator

Joshua is a graduate student at the USF. He has interests in business technology, analytics, finance, and lean six sigma.

The Windows calculator has four different types of calculators to choose from in its settings. You can also change the calculator to convert currency, volume and number of other metrics.

The Windows calculator has four different types of calculators to choose from in its settings. You can also change the calculator to convert currency, volume and number of other metrics.

In this tutorial, we look at how to activate the default Windows calculator from an Excel spreadsheet. This trick is for all of you Microsoft users that want to have the advantage of having a shortcut for frequent calculator use. That is if you can stand using the Windows calculator. It only takes a few steps to add a macro to a button to complete the setup. With that in mind, let’s get started.

Activate the Developer Tab

To have access to the tools that allow you to create a button, you must enable the developer tab on the Excel ribbon. If you will need to do this if you want to follow along and complete each step. To learn how to add the developer, open up this link in another browser tab.

The developer tab opens up a world of options for an Excel user. With the use of these hidden tools, you can automate processes, have access to XML options, manage Excel add-ins and manage Visual Basic Code.

The developer tab opens up a world of options for an Excel user. With the use of these hidden tools, you can automate processes, have access to XML options, manage Excel add-ins and manage Visual Basic Code.

Select a Button a to Add to the Spreadsheet

To add a button to the spreadsheet, click on the developer tab in the ribbon. Navigate to the controls section and select the insert button. Choose the button in the upper left-hand corner of the form controls section, as shown in the illustration below.

The insert tabs holds allow you to insert objects into your worksheets. You can create buttons, combo boxes, check boxes, list boxes, combo list and several other features. Using these tools gives you practice as a developer.

The insert tabs holds allow you to insert objects into your worksheets. You can create buttons, combo boxes, check boxes, list boxes, combo list and several other features. Using these tools gives you practice as a developer.

Draw a Box

Immediately after the button is clicked, you need to draw an outline of a square of a rectangle with your cursor to complete the creation of the button. This will determine the size and location of the button. To do so, left-click on your mouse and hold the button while you draw your shape. Once this is complete, a new window will appear.

The assign macro window give you the options start a new macro by recording to your button or add Visual Basic code to your button. To add functionality to a button one of these options needs to be selected. Recording a macro also create a macro code

The assign macro window give you the options start a new macro by recording to your button or add Visual Basic code to your button. To add functionality to a button one of these options needs to be selected. Recording a macro also create a macro code

Assign Macro Code to the Button

After the assign macro window appears, choose a name for your macro and select the new button. Doing so will open the Microsoft Visual Basic for Applications window. Here you can add the code located below that will activate the windows calculator application. Make sure that you keep the first line of codes where your button name appears and disregard the first line of code below.

Sub OpenCalculator()
Application.ActivateMicrosoftApp Index:=0
End Sub

After the code is inserted into the Visual Basic application, the Visual Basic window can be closed.

There are plenty of types of processes in Excel that can be automated by creating Visual Basic code. With a thorough understanding of Visual Basic coding you can develop your own sub programs from scratch to run in Excel to create automation.

There are plenty of types of processes in Excel that can be automated by creating Visual Basic code. With a thorough understanding of Visual Basic coding you can develop your own sub programs from scratch to run in Excel to create automation.

Changing the Label of the Button

To change the label on your button left clicking on the default text in the button, and your cursor will appear in the button, allowing you to edit. For this example, I’d like to change the name of my button label to Calculator so people know that it will call up a calculator. To change other properties of the button, right-click on it and choose format control. This will give you all of the design tools available to change the text design of the button and make other property changes.

Saving the Excel Workbook as a Macro-Enabled Workbook

In order for the assigned macro to function, the workbook must be saved as a macro-Enabled Excel workbook. To do so, click on the file tab and select save as. You can see an example of this selected highlighted in the illustration below. When saving, make sure you save the workbook with the selection outlined in red in the illustration below.

As you can see by the list generated from the save as button, Excel workbooks can be turned into a vast amount of file types. This can aid you depending you what type of report you need to create or in this case the type of function that you need to

As you can see by the list generated from the save as button, Excel workbooks can be turned into a vast amount of file types. This can aid you depending you what type of report you need to create or in this case the type of function that you need to

References

Crowder, J. (2020, January 1). How to Add the Developer Tab in Excel. Retrieved January 1, 2020, from https://youtu.be/nskuG6pK5ig.

To learn more about developing in Excel, I recommend taking a look at the book Microsoft Excel 2019 VBA and Macros (Business Skills) by Bill Jelen to enhance your skills.

This content is accurate and true to the best of the author’s knowledge and is not meant to substitute for formal and individualized advice from a qualified professional.

© 2019 Joshua Crowder

Related Articles