How To Allow Only One Checkbox Input in Excel
In this advanced excel tutorial, I’ll explain how you can allow user to select only one checkbox from a group of checkboxes in excel. If you have several checkboxes and you want your users to check only one box then you must restrict other boxes. Otherwise, users will most likely to click multiple boxes. This is a bit advanced feature and we’ll have to use vba to solve this. Now lets the follow the procedure below to create a system that will allow user to select only one checkbox from a group.
Creating Checkbox: We are going to create ActiveX Controls Checkboxes. Now follow the steps below to create checkboxes:
Step 1: Click on the Developer Tab
Step 2: Inside the “Control” Group, Select Insert.
Step 3: Now select Checkbox from ActiveX Controls
Step 4: Now size and place your checkbox in excel.
Naming Checkbox: Changing the checkbox caption is important. So, we are going to change the checkbox caption from Checkbox1 to our desired caption. So, lets change the caption of ActiveX Controls Checkboxes.
Step 1: Right click on the checkbox and click on the properties.
Step 2: Rename the caption top your need.
Make sure you change the caption part only. Do not change the name from there.
Creating Checkbox Class Module: In this part we are going to create a Class Module. Here is how to do it.
Step 1: Click on the developer tab and then visual basic.
Step 2: Click on Insert and Select Class Module.
Step 3: Click on View and then Properties Window.
Step 4: Now change the class name to CheckBoxClass
Step 5: Now paste the code. Here is the code link: [ Ссылка ]
Creating Module: In this step we need to add another part of code. Here is how to add it.
Step 1: Click on the developer tab and then visual basic.
Step 2: Now click on “Insert” and then “Module”.
Step 3: Now write the code. Here is the code link: [ Ссылка ].
Step 4: Now run the code by clicking the green play button.
Optimizing Workbook: To make this permanent for your workbook you need to add the last part of the code in the workbook section. Here is how to do it.
Step 1: Click on the developer tab and then visual basic.
Step 2: Now from the project explorer double click on “ThisWorkbook”
Step 3: Now paste the code in the code window. Here is the code link: [ Ссылка ]
Step 4: Now close the VBE.
From now on if you click on one checkbox then the rest of the checkbox will be disabled. If you uncheck the checkbox other boxes will be enabled.
Finalizing:
To make sure everything works in the future you need to save the workbook in .xlsm format which is Excel Macro Enabled Workbook.
#checkboxes #MsExcel #VBA
Thanks for watching.
----------------------------------------------------------------------------------------
Support the channel with as low as $5
[ Ссылка ]
----------------------------------------------------------------------------------------
Please subscribe to #excel10tutorial
[ Ссылка ]
Here goes the most recent video of the channel:
[ Ссылка ]
Playlists:
Advance Excel Tutorial: [ Ссылка ]
Excel Tutorial for Beginners: [ Ссылка ]
Excel Case: [ Ссылка ]
Combine Workbook & Worksheets: [ Ссылка ]
All About Comments in Excel: [ Ссылка ]
Excel VBA Programming Course: [ Ссылка ]
Social media:
Facebook: [ Ссылка ]
Twitter: [ Ссылка ]
Blogger: [ Ссылка ]
Tumblr: [ Ссылка ]
Instagram: [ Ссылка ]
Hubpages: [ Ссылка ]
Quora: [ Ссылка ]
Website: [ Ссылка ]
Ещё видео!