Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,311
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Count characters in a textbox to display character count? [email protected] Excel Programming 1 February 8th 07 06:31 AM
Max numbers of characters in userform textbox and cell N E Body Excel Programming 4 June 27th 05 06:25 PM
UserForm; Textbox; Multiline; NonPrintable Characters sa3214[_2_] Excel Programming 3 November 3rd 04 03:46 PM
how does excel store new line and line feed characters? ben h[_2_] Excel Programming 0 July 1st 04 02:34 AM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


All times are GMT +1. The time now is 10:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"