Mulitple Check Boxes

kod2th3e

Board Regular
Joined
Apr 2, 2008
Messages
87
I have a form with 5 check boxes and a command button. When I click the command button I want it to determine what check boxes are clicked and add the captions together in a string.

chkbox1.caption "Hand Solder"
chkbox2.caption "Mini Wave"
chkbox3.caption "X-Ray"
chkbox4.caption "Connector Replacement"
chkbox5.caption "Heat Gun"

So if I have a variable strprocess and I click the command button I want it to determine which of the above is checked (lets say chkbox1 and chkbox2) and make strprocess = chkbox1.caption & chkbox2.caption with a comma in between (Hand Solder, Miniwave). Any ideas/thoughts? Thanks for looking.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
not test but something like

Code:
strprocess = ""
If chkbox1.value = true then strprocess = chkbox1.caption & ","
if chkbox2.value = true then strprocess = strprocess & chkbox2.caption & ","
if chkbox3.value = true then strprocess = strprocess & chkbox3.caption & ","
etc, etc, etc

You may have to work out some logic if only one option is checked to get rid of any trailing ",", but it should get you started.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,268
Messages
6,171,100
Members
452,379
Latest member
IainTru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top