Forum Discussion

TimothySmith's avatar
TimothySmith
Copper Contributor
Jan 13, 2022

JoinText for a TextBox on a UserForm

Hello all,

 

I really appreciate the help I have received from this community. The knowledge I am gaining is priceless.

 

I posted a Join Text problem a few days ago and received a rapid reply with code which worked absolutely perfectly. I ran into a few problems with another piece of code that kept closing excel and wouldn't let me get into vba to kill the code. Luckily, I back up all my work into a copy before I try new code. I was able to pull up the working version however, decided that a UserForm would be the best way to go for what I am trying to accomplish. Below is the Code for the Text Join for a worksheet, does anyone know how to modify it to join the text in a textbox from 3 dropdown lists? The dropdown lists are attached to 3 different worksheets through the use of Rowsource in the properties field.  The UserForm is UserForm6. The ComboBoxes are ComboBox2, 3, and 4 and the text box is TextBox4. The reason for the text join is described below the code.

 

Private Sub CommandButton4_Click()

Dim result As String
Dim size As Integer
Dim cell_entries() As String
Dim i As Integer
Dim k As Integer
Dim j As Integer

size = 8
k = 4

For j = 3 To 20

ReDim cell_entries(size) 

For i = 0 To size

cell_entries(i) = Cells(j, k).Value
k = k + 1
Next i

result = Join(cell_entries)
Worksheets("Form").Cells(j, 14).Value = result

k = 1

Next j


End Sub

--------------------------------------------------------------------------------------------------------------

The reason for this text join is I have Monthly Cycle (Mid-Month and End Of Month), Month (January to December) and Year (2022 to 2050). I am trying to simplify this by having it put into the Performance Date text box to transfer to a table after the user clicks the submit button since those three things are the date stamp for evaluations.

 

I thank you for any help you may provide.

No RepliesBe the first to reply

Resources