link textbox to cell

P

pswanie

i got textbox1 thru textbox7 on a userform. when a user click commandbutton3
the info from textbox1 must go in the next open cell in column n
textbox2 must go in the next open cell in column m
textbox3 must go in the next open cell in column o
etc..

thanx

Phillip
 
J

JLGWhiz

Nothing fancy, but it should work.

Private Sub CommandButton3_Click()
Lr1 = Cells(Rows.Count, 14).End(xlUp).Row
Lr2 = Cells(Rows.Count, 13).End(xlUp).Row
Lr3 = Cells(Rows.Count, 15).End(xlUp).Row
On Error GoTo ErrHndl:
Range("N" & Lr1) = TextBox1.Text
Range("M" & Lr2) = TextBox2.Text
Range("O" & Lr3) = TextBox3.Text
ErrHndl:
If Err.Number <> 0 Then
MsgBox "No Text"
End If
End Sub
 

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