Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting unwated control characters at the end in a particular column


Greetings all !

I have used a user form to take userinput. The user "cut and paste
data from another window. The text box is formatted to warp text an
take multi line input

While saving in excel the Carriage returns are showing as contro
characters.

As such it is not giving any problems when the user does not cut extr
blank lines. If they cut extra blank lines (say 4 blank lines) at th
end of the data there are 4 squares (control characters). I trie
doing a find and replace and excel is not finding this character.

I need solution for this problem:

I want to remove the extra line feeds/carraige returns at the end
automatically.

1. Is there a function by which I can do it ?

2. How to read the last few characters in that cell and check whethe
it contain the carriage return.

3. I cannot do a global find and replace in that cell because th
other carriage return also would get replaced and all the line spacin
would be lost.

4. How to loop to check all the cells in that column ?

Thanks in advanc

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Deleting unwated control characters at the end in a particular column

Try the following function

Function RemoveTrailingLineFeeds(ByVal txt As String) As
String

Do While Right(txt, 1) = vbLf Or Right(txt, 1) = vbCr
txt = Left(txt, Len(txt) - 1)
Loop
RemoveTrailingLineFeeds = txt
End Function

Kevin Beckham

-----Original Message-----

Greetings all !

I have used a user form to take userinput. The user "cut

and paste"
data from another window. The text box is formatted to

warp text and
take multi line input

While saving in excel the Carriage returns are showing as

control
characters.

As such it is not giving any problems when the user does

not cut extra
blank lines. If they cut extra blank lines (say 4 blank

lines) at the
end of the data there are 4 squares (control

characters). I tried
doing a find and replace and excel is not finding this

character.

I need solution for this problem:

I want to remove the extra line feeds/carraige returns at

the end
automatically.

1. Is there a function by which I can do it ?

2. How to read the last few characters in that cell and

check whether
it contain the carriage return.

3. I cannot do a global find and replace in that cell

because the
other carriage return also would get replaced and all the

line spacing
would be lost.

4. How to loop to check all the cells in that column ?

Thanks in advance


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Deleting unwated control characters at the end in a particular column

You could use the =CLEAN() worksheet function to remove these
characters.
eg. in another column put =CLEAN(a1) and copy down. Then select the
column, Copy, Edit/Paste Special/Values, OK. Delete the original
column.

Regards
BrianB
================================================


ssexcel wrote in message ...
Greetings all !

I have used a user form to take userinput. The user "cut and paste"
data from another window. The text box is formatted to warp text and
take multi line input

While saving in excel the Carriage returns are showing as control
characters.

As such it is not giving any problems when the user does not cut extra
blank lines. If they cut extra blank lines (say 4 blank lines) at the
end of the data there are 4 squares (control characters). I tried
doing a find and replace and excel is not finding this character.

I need solution for this problem:

I want to remove the extra line feeds/carraige returns at the end
automatically.

1. Is there a function by which I can do it ?

2. How to read the last few characters in that cell and check whether
it contain the carriage return.

3. I cannot do a global find and replace in that cell because the
other carriage return also would get replaced and all the line spacing
would be lost.

4. How to loop to check all the cells in that column ?

Thanks in advance


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Deleting unwated control characters at the end in a particular column

Hi Kevin
Have you tried Application.Worksheetfunction.Clean(yourtext)?

regards
Paul
"Kevin Beckham" wrote in message ...
Try the following function

Function RemoveTrailingLineFeeds(ByVal txt As String) As
String

Do While Right(txt, 1) = vbLf Or Right(txt, 1) = vbCr
txt = Left(txt, Len(txt) - 1)
Loop
RemoveTrailingLineFeeds = txt
End Function

Kevin Beckham

-----Original Message-----

Greetings all !

I have used a user form to take userinput. The user "cut

and paste"
data from another window. The text box is formatted to

warp text and
take multi line input

While saving in excel the Carriage returns are showing as

control
characters.

As such it is not giving any problems when the user does

not cut extra
blank lines. If they cut extra blank lines (say 4 blank

lines) at the
end of the data there are 4 squares (control

characters). I tried
doing a find and replace and excel is not finding this

character.

I need solution for this problem:

I want to remove the extra line feeds/carraige returns at

the end
automatically.

1. Is there a function by which I can do it ?

2. How to read the last few characters in that cell and

check whether
it contain the carriage return.

3. I cannot do a global find and replace in that cell

because the
other carriage return also would get replaced and all the

line spacing
would be lost.

4. How to loop to check all the cells in that column ?

Thanks in advance


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting unwated control characters at the end in a particular column


Thanks Kevin, your code works fine.

The problem with CLEAN() is that it knocks off all the carriage returns
and the paragraph formatting is lost.

Thanks once again to everyone who wrote.

Another related question: If these boxes appear at the end of each and
every para (since they are carriage returns) how do I "catch" them ?

Regards


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

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
Viewing Control Characters PVodola Excel Discussion (Misc queries) 3 February 5th 10 01:27 PM
Deleting Characters Vinny0128 Excel Discussion (Misc queries) 2 May 7th 07 03:19 AM
Deleting rows with 11+ characters. Sinner Excel Worksheet Functions 4 April 2nd 07 11:50 AM
Deleting rows with 11+ characters. Sinner Excel Discussion (Misc queries) 0 March 29th 07 04:53 PM
deleting check control box Brad Excel Discussion (Misc queries) 1 September 29th 05 08:21 PM


All times are GMT +1. The time now is 11:50 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"