I have a multi-line text box in开发者_运维技巧 Excel. I have linked this text box with a cell, for example we will say this is linked with cell("A1").
EXAMPLE: I enter "Hello" into the multi-line text box and press ENTER. This will write "HELLO" into cell("A1"). I then type, "World" into the text box and hit ENTER again. I would like this to write "World" into the cell("A2").
Can anybody explain the best way of doing this please?
Thanks, James.
Remove the link to the cell and try this:
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
Sheet1.Range("IV1").End(xlToLeft).Offset(0, 1) = TextBox1
TextBox1 = vbNullString
End If
End Sub
精彩评论