I have a Userform that has ~30 check boxes (chkbx1,...chkbx30). Each check box represents a numerical value. When the user submits the form I would like to sum the total value of all selected check boxes.
How can i do this?
I have a Userform that has ~30 check boxes (chkbx1,...chkbx30). Each check box represents a numerical value. When the user submits the form I would like to sum the total value of all selected check boxes.
How can i do this?
is the value the caption?
if so something like
**this only works if the caption is only the numberPlease Login or Register to view this content.
Last edited by humdingaling; 07-31-2013 at 12:38 AM.
If you are satisfied with the solution(s) provided, please mark your thread as Solved.
Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.
No, sorry the caption is not the number value I want to tally.
what/how/where is the number do you want to tally then?
i have an if value=true assignment
there is probably a better way to do it, but I am not sure how.Please Login or Register to view this content.
*duplicate post*
Last edited by lbi; 07-31-2013 at 11:13 AM.
Can you clarify exactly what you have?
In the first post you say the checkboxes are named chkbx1, chkbx2 etc but in the code in the last post you seem to have controls named BL and BT.
Also, where do the values for each checkbox come from?
If posting code please use code tags, see here.
Sorry, I have been continuing to work on this and modifying the original code.
The check boxes are named using 2 letter codes representing a longer name for a charge for that check box.
The end result will be this:
User selects a task from a drop down, then checks-off the appropriate boxes that calculate the charge for that task.
I have the drop down list generated and the check boxes created.
I am willing to change how the check boxes are displayed if that makes it easiest to accomplish this, but currently the Caption is more of a description than integer value. Should I need to change the Caption to the value, I can overwrite with a label.
You don't need to change the caption, there are other ways to store the value.
For example you could use the Tag property of the checkboxes.
You could even store them on a worksheet and use a lookup based on the current captions.
Unless you do something like that you'll find yourself repeating code like that you posted in #5 for each checkbox.
By the way, have you considered using a listbox do list all the charges?
It could be set up to show a checkbox next to each charge and the value could be stored in a hidden column.
With that it would be simple to add up the values, all you would need to do is loop through the list in the listbox.
Thank you for the reply Norie.
In fact all of these values are listed on a work sheet with the 2 letter code, full description as well as the charge value.
A list box would be fine, but I dont want users having to scroll through to find everything. that was the appeal of the check boxes.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks