LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default CRLF in text box

Can anyone explain the following behaviour, or perhaps more likely,
tell me what I'm doing wrong? I thought I had done this many times
before

Set up a Userform with a textbox, e.g. TextBox1, that has both
EnterKeyBehavior and MultiLine set to True. Enter a single character
followed by a Return - the textbox should then contain, for example:
"aCRLF"

Now, if I want to remove the CRLF, I have been using:

With UserForm
Do While Right(.TextBox1.Text, 2) = vbCrLf
.TextBox1.Text = LeftB(.TextBox1.Text, Len(.TextBox1.Text) - 2)
Loop
End With

Now, this code loops, because when I examine the results of the Left
(or LeftB - the results are the same) function, .TextBox1.Text still
contains the CRLF. The only way I can get it to work is to store the
original text, set .TextBox1.Text to "", and then store the results of
the Left function back in the textbox.

What is happening here? It's an easy bypass, but I may have used this
technique elsewhere and would like to know whether I need to change
other instances of this type of code.

Excel version is 2002 running on XP professional.

Many thanks in advance for any help received.

Neil
 
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
How do I get SQL data to show CRLF instead of question marks? Number2 Excel Discussion (Misc queries) 0 November 15th 09 05:15 AM
Cut and Paste Text with CRLF into Single Cell Jim Excel Discussion (Misc queries) 1 January 10th 08 08:57 PM
Making tab do a CRLF when reaching end of a range John A Excel Discussion (Misc queries) 3 May 10th 07 02:13 AM
HELP - How to replace CRLF with a character withing an excel column Dino Buljubasic Excel Discussion (Misc queries) 1 August 25th 05 07:49 PM
extracting text from within a cell - 'text to rows@ equivalent of 'text to columns' Dan E[_2_] Excel Programming 4 July 30th 03 06:43 PM


All times are GMT +1. The time now is 05:29 PM.

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

About Us

"It's about Microsoft Excel"