Hi all,
I've managed to get so far, but am now stumped,... all i need to do is grab the captions of all checkboxes that have a value of true (checked)(there are 50 check boxes on the excel userform), and have that answer automatically concatenate (as it were) and fill in to a text box upon hitting the updateform button on the form I've created, eg 'caption1, caption6, caption34, caption 40, caption47' but i cant seem to get any further than it populating the very last value e.g.'caption47'...could some one please point me in the right direction on this?
Here is what i've got so far....
Any help getting this figured out would be greatly and grovellingly appreciated!!!!!Private Sub updateform_Click() Dim x As Integer Dim ctrl As Control Dim myArray() As String x = 1 For Each ctrl In Me.Controls If TypeName(ctrl) = "CheckBox" Then If ctrl.Value = True Then x = x + 1 ReDim Preserve myArray(x) myArray(x) = ctrl.Caption End If End If Next TxtAddition.WordWrap = True TxtAddition.MultiLine = True TxtAddition.Text = myArray(x) End Sub
Thank you in advance!!!!!!
Brujah
Last edited by brujah; 02-27-2012 at 09:47 AM.
Try this:
Dim x As Integer Dim ctrl As Control Dim myArray() As String x = 0 For Each ctrl In Me.Controls If TypeName(ctrl) = "CheckBox" Then If ctrl.Value = True Then ReDim Preserve myArray(x) myArray(x) = ctrl.Caption x = x + 1 End If End If Next txtaddition.WordWrap = True txtaddition.MultiLine = True txtaddition.Text = Join(myArray, vbLf)
Good luck.
Rory, you are my hero, knew it had to be summit simple i was missin but nothing i tried worked... i is rubbish, and you are great!!! thank you so much, all doing exactly as i wanted now!!!
regards Brujah
My pleasure. Please don't forget to mark the thread Solved (see FAQ at top of the page)
Good luck.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks