How To Make Radio Buttons Larger With Excel VBA

Microsoft Excel allows you to create the form with radio buttons, text boxes, check boxes and everything needs to complete the form. Here’s the problem though, form elements in Excel are small and you can’t make them larger.

Even if you try to make them larger you are not lucky enough as it does not make large enough. Excel MVP Jordan Goldmeier will let you know how to make Radio Buttons larger with Excel VBA. You can apply the same technique for other form elements in Excel.

Steps to Make Radio Buttons Larger With Excel VBA

To proceed further as part of the tutorial, first you need to make sure that Excel you are using needs to have Developer tab and Camera icon. If they are not enabled, follow below steps.

1 – Enable Developer Tab in Excel

  1. Click on ‘File’ Tab and then on ‘Options’ on the left side.
  2. From the ‘Excel Options’ dialog box, click on ‘Customize Ribbon’ on the left side.
  3. On right side, under ‘Main Tabs’ tick the option ‘Developer’ and click Ok. Now, you could see Developer Tab in Excel.1

2 – Add Camera Icon to Excel

  1. Follow Step 1 as above.
  2. On left side click on ‘Quick Access Toolbar’.
  3. From the dropdown ‘Choose commands from’ select the option ‘All Commands’.
  4. All options are displayed alphabetically and scroll down till you see ‘Camera’ option.
  5. Select ‘camera’ option and click on ‘Add’ button. It gets added to the ‘Customize Quick Access Toolbar’.
  6. Click ‘Ok’ and you could see that Camera icon being added to Excel.

3 – Insert Radio Buttons in Excel

Now, in this step lets us create the normal Radio Buttons which Excel provides us.

  1. Under Developer tab in Controls section, click on the Insert It shows you different form controls and click on Option button symbol from them (Last option in the first line).
  2. Now click on the spread sheet where you want to place this Option button. If you want to add more number of these buttons, copy the previous button and paste it where you want.
  3. If you see, I added 3 Options buttons in the Spread sheet. You can edit the label by right clicking on it and click ‘Edit Text’.2

4 – Add Format Control to Radio Buttons

Format Control returns the unique value for every Radio Button you selected. This will let you know which Radio Button was checked and can use that value wherever needed. Let us do that now.

  1. Right click on the Radio Button added and click ‘Format Control’.
  2. In ‘Format Controls’ dialog box, under ‘Control’ tab refer to the cell where you want to display the value of the selected Radio Button.
  3. In this example, I selected ‘G3’ cell to display the selected Radio Button.
  4. Now, let us give the name to the G3 cell as ‘CheckboxReturnedValue’ by selecting the cell G3 and typing the name in Name Box.3

5 – Create Snapshots of the Added Radio Buttons

  1. Highlight the radio button and click on the Camera Button.
  2. It copies the snapshot and click on the spreadsheet where you want to add it.
  3. Repeat this for other 2 Radio Buttons also.
  4. Now, you could see 3 radio buttons and their snapshots added. You can enlarge these snapshots by dragging the corners.
  5. Let us name each of these snapshots as Button1, Button2 and Button3 respectively using Name Box.

6 – The Trick (VBA Code)

To make Radio Buttons Larger in Excel we write the VBA code now.

  1. Under ‘Developer’ tab click on the ‘Visual Basic’ option.
  2. It opens the ‘Microsoft Visual Basic for Applications’.
  3. Now, copy the below VBA code and paste it.

Public Sub WriteNumberToResponse()

Dim ButtonIndex As Integer

ButtonIndex = CInt(Replace(Application.Caller, Button, “”))

[CheckboxReturnValue].Value = ButtonIndex

End Sub
Jordan has explained the each and every line of the code in the video.4

7 – Assign Macro to the Radio Button Snapshot

Now, right click on the snapshot of the Radio Button and click ‘Assign Macro’ option. Next, select the created macro and click ‘Ok’. Do this for all the snapshots of the Radio Buttons. From now on, when you click on the snapshot, you could see the returned value.5

Get The Download

Sridhar Belide


You may also like

April 23, 2014

A VBA Coding Manifesto (Part 1)

May 3, 2014

A VBA Coding Manitesto (Part 2)

December 22, 2013

Excel Holiday Card
  • The vba code gives the “type mismatch” run time error on this line
    ButtonIndex = CInt(Replace(Application.Caller, Button, “”))

    Also the file made available to download does not have any data/macros

    • I think one of the reasons for the error is because cell G3 was labelled as ‘CheckboxReturnedValue’ vs ‘CheckboxReturnValue’ in the code.

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Free 24 Excel Tips Guide

    Discover the secrets to Excel efficiency with our free guide: '24 Proven Microsoft Excel Tips to Help You Save Time'

    A humble gift from us to you, to make your Excel journey smoother and more productive. Grab your copy now and start mastering Excel like never before!