How To Allow Only One Checkbox to Be Checked in Excel
HTML-код
- Опубликовано: 18 авг 2024
- 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: / 71682969
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: / 71682969 .
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: / 71682969
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
/ excel10tutorial
----------------------------------------------------------------------------------------
Please subscribe to #excel10tutorial
goo.gl/uL8fqQ
Here goes the most recent video of the channel:
bit.ly/2UngIwS
Playlists:
Advance Excel Tutorial: goo.gl/ExYy7v
Excel Tutorial for Beginners: goo.gl/UDrDcA
Excel Case: goo.gl/xiP3tv
Combine Workbook & Worksheets: bit.ly/2Tpf7DB
All About Comments in Excel: bit.ly/excelco...
Excel VBA Programming Course: bit.ly/excelvba...
Social media:
Facebook: / excel10tutorial
Twitter: / excel10tutorial
Blogger: excel10tutoria...
Tumblr: / excel10tutorial
Instagram: / excel_10_tutorial
Hubpages: hubpages.com/@...
Quora: bit.ly/3bxB8JG
Website: msexceltutoria...
Hello! Thank you for an awesome video. In my spreadsheet, I have 40 rows of checkboxes with two checkboxes on each row (Yes or No). How can I set checkbox capability to be able to only select one checkbox (yes or no) per each row?
Adding onto this comment as I have the same request as well!
HI there. Thank you for the explaination. It's very useful. Can you share how to count activex checkbox?
the explanation is easy to understand, thank you and greetings from Indonesia 🇮🇩
Thanks a million for the comment. Please subscribe and share.
@@Excel10tutorial you're welcome 👌
Hello, the explanation is really useful. How can I apply it to an entire column in excel?
Thank you for explanation! How can I allow more than one check box?
Hello and congratulations on your work! I wrote the same code and it works. However, when there are other calculations on the sheet, it doesn't work. Can I send you the file sample that i made for review?
Send me
Hey there. It doesnt't work form me, i don't know what the problem is... can you help me please?
It should. Try again. Make sure you save the workbook as .xlsm format.
I cannot access the VBA code using the link you provided. It requires that I since up for a paid annual subscription to view the code.
Nope. Its free for everyone. Please check again.
hey, i have a curious problem when i do it this way. As soon as I go to print, I don't see a preview of the document as it looks when printed. This is only the case when an ActiveX checkbox is ticked, do you have an idea?
Right-click on the checkbox, and select Format Control.
Go to Properties Tab.
Tick mark “Print Object”.
@@Excel10tutorial hey thank you for the reply. Ive forgot to say that im trying to build this in Microsoft Word. Unlucky there is not the option for that. Do you have an idea for Word?
I code cant run, macro dialogue box opens