Multiline textbox for data entry

×

×לי

Hi,
I have an Excel database with data entry form that contain a multiline
textbox. my problem is that the multiline information in the textbox (up to
15 lines) is copied into one multiline cell in the list, and i want the
information of each line to be stored in a separated cell and row, so a 15
lines in the textbox will be stored as 15 cells.

Thanks in advance

Eli
 
N

NickHK

Eli,
Depending on what you want to happen if there are not 15 lines of text
(either more or less):

Private Sub CommandButton1_Click()
Dim TempStr() As String

TextBox1.Text = "Line 1" & vbNewLine & "Line 2" & vbNewLine & "Line 3" &
vbNewLine & "Line 4" & vbNewLine & "Line 5"

TempStr = Split(TextBox1.Text, vbNewLine)

Range("A1").Resize(15).Value = Application.Transpose(TempStr)
'Or
Range("A1").Resize(UBound(TempStr) + 1).Value =
Application.Transpose(TempStr)

End Sub

NickHK
 
×

×לי

Thanks very much!!!

Eli

NickHK said:
Eli,
Depending on what you want to happen if there are not 15 lines of text
(either more or less):

Private Sub CommandButton1_Click()
Dim TempStr() As String

TextBox1.Text = "Line 1" & vbNewLine & "Line 2" & vbNewLine & "Line 3" &
vbNewLine & "Line 4" & vbNewLine & "Line 5"

TempStr = Split(TextBox1.Text, vbNewLine)

Range("A1").Resize(15).Value = Application.Transpose(TempStr)
'Or
Range("A1").Resize(UBound(TempStr) + 1).Value =
Application.Transpose(TempStr)

End Sub

NickHK
 

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