How to Add Button in Excel (3 Handy Ways)

In Excel, we often have to do repetitive work. Macros reduce our efforts and save us from the monotony of repetition. Excel buttons make this task easier. With the click of a button, we can do a mammoth task in seconds. So, in this article, we will show you how to add button in Excel.


Download Practice Workbook

You can download the practice workbook from here.


3 Handy Ways to Add Button in Excel

In this article, we will use three easy ways to add a button to our Excel worksheet. Firstly, we will use shapes to add buttons. Then, we will use the Form Controls option. Finally, we will opt for the ActiveX Controls feature to add a button.


1. Using Shapes to Add Button in Excel

In this method, we will use shapes to insert buttons in Excel. We will be able to format the shapes according to our needs and aesthetics to make suitable buttons.

Steps:

  • Firstly, go to the Insert tab.
  • Then, select Shapes.

inserting shapes to add button in excel

  • After that, from the drop-down list, choose any shape that has a resemblance to a button.
  • In this case, we will choose the Rectangles.

  • Consequently, we will have a rectangle on our preferred cell.

  • Then, you could customize the rectangle by going to the Shape Format tab and choosing different options from there.

formatting shapes to add button in excel

  • Then, give the button a name.
  • In this case, we will name it Eligibility.
  • After that, center the text.
  • You can also format the text with “Bold text” and other text formatting tools.

  • Then, right-click on the rectangle.
  • From the available options, select the Assign Macro command.
  • As a result, the Assign Macro dialogue box will appear.

assigning macros to add button in excel

  • Choose “This Workbook” from the Macros in option in the dialogue box.
  • Then, select New.

  • Consequently, we will have a coding module on the screen.
  • Then, write the following code in the module and save it.

writing code to add button in excel

Sub Coloring()
Dim i As Integer
i = 5
Do While i <= 11
  If (Cells(i, 3).Value < 18) Then
     Cells(i, 4).Interior.Color = vbRed
  Else
     Cells(i, 4).Interior.Color = vbGreen
  End If
i = i + 1
Loop
End Sub
  • After that, if we hover the cursor on the button, we will have a changed icon of the cursor.
  • Finally, hit the button.

  • Consequently, the macro will be executed.

using shapes to add button in excel

Read More: How to Add Option Button in Excel (With Easy Steps)


2. Utilizing Form Controls Option

In this instance, we will choose the Form Controls option to add a button. We will assign a macro to the button to do our task with a click of the button.

Steps:

  • To start with, go to the Developer tab.
  • From there, select the Insert option.
  • Finally, from the drop-down select the Button command from the Form Controls option.

using form controls to add button in excel

  • Consequently, we will see a changed cursor and it will be like a plus sign.

naming button to add button in excel

  • Drag the plus sign and create a button.
  • Then, give the button a name.

  • Then, change the alignment and format of the text for aesthetic purposes.

formatting buttons to add button in excel

  • After that, right-click on the button.
  • From the options, select Assign Micro.
  • As a result, the Assign Macro dialogue box will appear.

  • From the dialogue box, select “This Workbook” from the Macros in box.
  • Next, choose New.

adding new macro to add button in excel

  • As a result, a coding module will appear on the screen.
  • Then, write the following code on the module and save it.

writing and saving code to add button in excel

  • As a result, we will see a hand-like cursor.
  • Finally, hit the button with the cursor.

applying cursor to add button in excel

  • As a result, Excel will execute the command.

Read More: How to Remove a Form Control in Excel (3 Quick Ways)


Similar Readings


3. Use of ActiveX Controls Option

In the final method, we will opt for the ActiveX Controls feature to do the task. This feature is a bit sensitive. So we will have to use it carefully.

Steps:

  • To begin with, go to the Developer tab.
  • Then, select the Insert option.
  • Finally, select the Command Button command from the ActiveX Controls option.

using activex controls option to add button in excel

  • As a result, the cursor will turn into a plus sign.

applying plus-signed cursor to add button in excel

  • Then, make a button by dragging the plus sign.
  • After that, right-click on the button.
  • Finally, from the options select the View Code command.
  • As a result, we will have a coding module on the screen.

applying view code command to add button in excel

  • Then, write the code below on the module and save it.

writing vba code to add button in excel

Sub grading()
Dim i As Integer
i = 5
Do While i <= 11
   Select Case Cells(i, 3).Value
       Case 60 To 69: Cells(i, 4).Value = "D"
       Case 70 To 79: Cells(i, 4).Value = "C"
       Case 80 To 89: Cells(i, 4).Value = "B"
       Case 90 To 100: Cells(i, 4).Value = "A"
       Case Else: Cells(i, 4).Value = "Failed"
   End Select
   i = i + 1
Loop
End Sub
  • Then, hit the Command Button.

  • As a result, the code will be executed.

using activex controls applying cursor to add button in excel

Read More: Key Differences in Excel: Form Control Vs. ActiveX Control


How to Create Button in Excel Without Macro

In this method, we will add a button that has no macro associated with it. We will insert a button that can increase or decrease the numbers of a certain cell.

Steps:

  • To begin with, go to the Developer tab.
  • Then, select the Insert option.
  • Finally, from the drop-down select the Spin Button from the Form Controls option.

  • Then, a plus button will replace the cursor.

  • Now, drag the sign to create a button.
  • Then, right-click on the button and select Form Control from the available options.

  • After that, in the Form Control dialogue box, select the cell that you want to link to the button in the Cell link
  • In our case, the cell was C5.
  • Then, click OK.

  • Then, move the cursor down to add the button to each data cell.
  • Also, add the respective cell to each Cell link box.

  • Finally, press the button to add numbers to each cell of the “Sales Quantity” column.

  • As a result, we will have sales quantities by using a button that is associated with no macro.

Read More: How to Create Button Without Macro in Excel (3 Easy Ways)


Link Excel Button to Another Sheet

In this example, we will link one sheet to another via a button. The button will take us to the linked sheet as soon as we press it.

Steps:

  • To begin with, go to the Insert tab.
  • Then, select the Shapes option.

  • After that, select any button-like shape from the drop-down menu.
  • In this instance, we’ll pick rectangles.

  • As a result, a plus-shaped cursor will be on the screen.

  • Then, move the plus cursor to make a rectangular shape.
  • After that, right-click on the shape, and from the drop-down menu, select Link.

  • From the Insert Hyperlink dialogue box, first select the Place in This Document option.
  • Then, select the cell where the link will land in the desired worksheet.
  • Select the sheet that you want to link with the working sheet.
  • Finally, click OK.

  • As a result, the shape will turn into a button.
  • Hit the button.

  • As a result, Excel will take us to the linked worksheet.

Read More: How to Create Button to Link to Another Sheet in Excel (3 Ways)


Excel Toggle Button

In this case, we will insert a toggle button in our worksheet. When a toggle button is clicked, it indicates whether a state is enabled or disabled. This is a really handy feature in Excel.

Steps:

  • Firstly, select the Developer tab from the ribbon.
  • Then, choose the Insert option.
  • Finally, select the Toggle Button command under the ActiveX Controls option.

  • As a result, a plus-shaped cursor will be on the screen.

  • Drag the cursor to make a toggle button.
  • Then, right-click on the button.
  • From the drop-down options, select the View Code option.
  • As a result, a coding module will appear.

  • Then, write the following code in the module.
  • Save the code.

Sub Button3_Click()
Dim i As Integer
i = 5
Do While i <= 11
   Select Case Cells(i, 3).Value
       Case 60 To 69: Cells(i, 4).Value = "D"
       Case 70 To 79: Cells(i, 4).Value = "C"
       Case 80 To 89: Cells(i, 4).Value = "B"
       Case 90 To 100: Cells(i, 4).Value = "A"
       Case Else: Cells(i, 4).Value = "Failed"
   End Select
   i = i + 1
Loop
End Sub
  • Finally, hit the toggle button.

  • As a result, the code will be executed.

Read More: How to Change Cell Value Using Toggle Button in Excel


Conclusion

In this article, we have talked about how to add a button in Excel. This will allow users to insert a button and use them to make their lives easier and quicker.


Related Articles

Adnan Masruf

Adnan Masruf

I am an engineering graduate. I graduated from Bangladesh University of Engineering and Technology(BUET), one of the top universities in Bangladesh from department of Naval Architecture & Marine Engineering with a major in structure. I am an avid reader of fiction especially fantasy. I also keep myself abreast of the recent developments in science and technology. I believe diligence will eventually pay off and luck tends to favor those who work hard.

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo