Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Application trim or rtrim

I've imported file to Excel. I've tried, without sucess, to delete trailing
blanks. I tried RTrim, Application.Trim but still have these blaks or spaces
at the end. Any suggestions?
Thanks in advance
--
HJN
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Application trim or rtrim

1. have you tried trim?
2. are you sure they are spaces?

--


Gary

"Hennie Neuhoff" wrote in message
...
I've imported file to Excel. I've tried, without sucess, to delete
trailing
blanks. I tried RTrim, Application.Trim but still have these blaks or
spaces
at the end. Any suggestions?
Thanks in advance
--
HJN



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Application trim or rtrim

You probably do not have spaces at the end of your text. My guess is you got
your text from the web and there are characters with ASCII code 160 where
you think there are spaces. Put this code immediately after you assign the
text to your variable (since you didn't post the variable's name, I'll use
YourVariable for it in the code)...

For XX = 1 To Len(YourVariable)
Debug.Print "<" & Mid(YourVariable, XX, 1) & "" & _
" - " & Asc(Mid(YourVariable, XX, 1))
Next

and then look in the Immediate window to see what the ASCII code is for
those characters. If I am right, you can use this statement...

YourVariable = Trim(Replace(YourVariable, Chr(160), ""))

to get rid of them and any spaces that remain after the replacement. If you
have something other than ASCII 160 characters, then use their ASCII code in
the above line of code instead.

--
Rick (MVP - Excel)


"Hennie Neuhoff" wrote in message
...
I've imported file to Excel. I've tried, without sucess, to delete
trailing
blanks. I tried RTrim, Application.Trim but still have these blaks or
spaces
at the end. Any suggestions?
Thanks in advance
--
HJN


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Application trim or rtrim

I had been struggling with this same problem for the last 24 hours. Very
very glad to read your post Rick. For my problem, I replaced character(160)
with " " and then RTrimmed the heck out of my rows.

Thanks again!

"Rick Rothstein" wrote:

You probably do not have spaces at the end of your text. My guess is you got
your text from the web and there are characters with ASCII code 160 where
you think there are spaces. Put this code immediately after you assign the
text to your variable (since you didn't post the variable's name, I'll use
YourVariable for it in the code)...

For XX = 1 To Len(YourVariable)
Debug.Print "<" & Mid(YourVariable, XX, 1) & "" & _
" - " & Asc(Mid(YourVariable, XX, 1))
Next

and then look in the Immediate window to see what the ASCII code is for
those characters. If I am right, you can use this statement...

YourVariable = Trim(Replace(YourVariable, Chr(160), ""))

to get rid of them and any spaces that remain after the replacement. If you
have something other than ASCII 160 characters, then use their ASCII code in
the above line of code instead.

--
Rick (MVP - Excel)


"Hennie Neuhoff" wrote in message
...
I've imported file to Excel. I've tried, without sucess, to delete
trailing
blanks. I tried RTrim, Application.Trim but still have these blaks or
spaces
at the end. Any suggestions?
Thanks in advance
--
HJN



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
Application.Trim with VBA Jeff Excel Discussion (Misc queries) 2 April 24th 06 09:18 PM
RTrim as a variable Emory Richter Excel Programming 6 September 4th 05 05:11 AM
VBA Trim and Application.worksheetfunction.Trim Hari Prasadh Excel Programming 3 January 19th 05 02:22 PM
I can't seem to use RTRIM or LTRIM in Excel 2002. I want to trim. Pam New Users to Excel 3 December 2nd 04 12:08 AM
Trim like worksheet Trim Bob Phillips[_5_] Excel Programming 0 August 20th 03 07:10 PM


All times are GMT +1. The time now is 01:07 PM.

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"