Consulting

Results 1 to 3 of 3

Thread: Fill Userform Text Box From Worksheet

  1. #1
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    323
    Location

    Fill Userform Text Box From Worksheet

    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

  2. #2
    VBAX Tutor
    Joined
    Mar 2014
    Posts
    210
    Location
    1 text box = 1 name.
    use lists for multiple names, aka, spreadsheet.

  3. #3
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    323
    Location
    Thanks, used listbox and is much easier.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •