PDA

View Full Version : [SOLVED] Fill Userform Text Box From Worksheet



zoom38
01-15-2018, 07:59 AM
Good morning, I have a textbox on a userform that I wish to fill with names from a worksheet. The number of names can change each time the userform is activated. Can multiple lines be added to the textbox using code or do I have to use a textbox for each name? I do have textbox1.multiline = true set in the userform activate sub. An example of what i'm looking for is:

The following are the people that are currently assigned:
Jones
Smith
Jackson

The number of names may change.

This is what I have so far. This only shows the last iteration on the userform textbox. I just don't know where to put the line t(x) & vbcrlf to add to Tmsgbox, if its even possible.

If Current = 1 Then
TMsgBox = t(1) & " is the only one currently assigned."
ElseIf Current > 1 Then
For x = 4 To LastRow
TMsgBox = "The Following are the people that are currently assigned:" & vbCrLf & _
t(x) & vbCrLf
Next x
End If


thanks in advance

ranman256
01-15-2018, 08:21 AM
1 text box = 1 name.
use lists for multiple names, aka, spreadsheet.

zoom38
01-15-2018, 09:13 AM
Thanks, used listbox and is much easier.