View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Charlie Charlie is offline
external usenet poster
 
Posts: 703
Default Trim special charcters from start of string

If the characters are in the other order than you specified, i.e. Chr(13)
then Chr(10) (CarriageReturn/LineFeed) you can do this

Do While Left(MyStr, 2) = vbCrLf
MyStr = Mid(MyStr, 3)
Loop


"John Michl" wrote:

Thanks. That almost works. I only want to remove those characters if
they are before the first real text in a string. Using CLEAN on my
string eliminates all of the carriage returns later on the string that
I want to keep. Something like LTRIM would be perfect but there
doesn't seem to be a LCLEAN.

What I'm trying to do is retrieve text from a text box that has been
edited by the user. I need someway to determine what position contains
the first non-special character (i.e., real text) so that I can start
the retrieval at that point.

- John

JMB wrote:
Try Excels CLEAN function

strTemp = application.clean(strTemp)



"John Michl" wrote:

Is there a function or quick VBA routine that will remove and CHR(10)
or CHR(13) characters from the begining of a string.

If not, how about someway to find the first non-special character in a
string?

Thanks for the help.

- John