Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count characters in 1st line of UserForm Textbox
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count characters in 1st line of UserForm Textbox
Paul,
Can you use a fixed-width font, then calculation would be possible. NickHK "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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Count characters in a textbox to display character count? | Excel Programming | |||
Max numbers of characters in userform textbox and cell | Excel Programming | |||
UserForm; Textbox; Multiline; NonPrintable Characters | Excel Programming | |||
how does excel store new line and line feed characters? | Excel Programming | |||
UserForm TextBox to ActiveSheet TextBox over 256 characters | Excel Programming |