View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Count characters in 1st line of UserForm Textbox

If the lines of text in the text box are separated by line break characters,
you could use code like

Dim Pos As Integer
Me.TextBox1.Text = "first line" & vbNewLine & _
"second line"
Pos = InStr(1, Me.TextBox1.Text, vbNewLine)
If Pos 0 Then
MsgBox "Line 1 Length: " & Pos - 1
End If

If there are no line break characters, I don't think you can parse out just
the first line.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"PCLIVE" wrote in message
...
To count all of the characters (including spaces) in a UserForm Textbox, I
can use:

Len(UserForm1.DayList.Text)

Is there a way to just count the number of characters that are in the
first line of that textbox?

Thanks,
Paul