Textbox data to cell

P

Pats

My userform has a TextBox for First Name , Last Name and Employee #. What I
need to know is, how can I put the contents of all 3 Textboxes into one cell?

Example:

Last Name, First Name - Employee #
 
F

FSt1

hi
this should do it. adjust ranges to suit.
Range("C5").Value = _
Me.TextBox2.Value & ", " & Me.TextBox1.Value & " - " & Me.TextBox3.Value

regards
FSt1
 
J

JLGWhiz

Assuming the text boxes are numbered in the same order that you listed them,
you could:

Private Sub UserForm_Click()
ActiveSheet.Range("A1") = Me.TextBox2,Value & "," & _
Me.TextBox1.Value & "-" & Me.TextBox3.Value
End Sub

But I would seriously consider putting the employee number in a separate
column for sorting, searching, etc. at a later date if needed.
 
D

Dave Peterson

I don't understand the difference.

Do you not like variables or do you not like qualifying the ranges?
 
F

FSt1

hi
opps. posted under the wrong post.
i read the op's request. i have a play form where i test stuff before
posting. when i came back, you had already posted with almost the same thing
i had. i had already did the work so i thought i would just toss in my 2
cents any way. but posted under your post instead of the op's. sorry. my bad.

Regards
FSt1
 
D

Dave Peterson

Ah.

No problem. I am no longer confused--well, about that <vbg>.
hi
opps. posted under the wrong post.
i read the op's request. i have a play form where i test stuff before
posting. when i came back, you had already posted with almost the same thing
i had. i had already did the work so i thought i would just toss in my 2
cents any way. but posted under your post instead of the op's. sorry. my bad.

Regards
FSt1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top