Textjoin based on checkbox

Gixxer Lad

New Member
Joined
Dec 21, 2004
Messages
21
Office Version
  1. 365
Platform
  1. Windows
Good evening all,
I would like a little assistance if possible, I have a userform with a list of names (labels) and a checkbox for each one, what I am after is to textjoin all the selected names separated by a comma.
For example, with the scenario below I would like to have the text "Bill, George, Luke" in cell A1 when the userform is exited.
I have been trying with the likes of:

dim str as string
str = worksheetfunction.textjoin ?? IF ????????????
and then transferring str to cell A1

But I am having no luck so must be doing something wrong.

As always, any help is greatly appreciated.
Kind regards
1698174300485.png
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Additional
labels are Label1, Label2, Label3 and checkboxes are Checkbox1, Checkbox2, Checkbox3 etc.
 
Upvote 0
I would imagine looping through the checkboxes and for each one checked, add to the text string with the label value and a comma.

This is not exact code.. just an example of the process I am imagining.

Rich (BB code):
Loop
If check box checked = true Then
  str = str & label.name & ","
End If
Next
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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