PC Review


Reply
Thread Tools Rate Thread

Application trim or rtrim

 
 
Hennie Neuhoff
Guest
Posts: n/a
 
      13th Oct 2008
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 With Quote
 
 
 
 
Gary Keramidas
Guest
Posts: n/a
 
      13th Oct 2008
1. have you tried trim?
2. are you sure they are spaces?

--


Gary

"Hennie Neuhoff" <(E-Mail Removed)> wrote in message
news:115F33B6-2197-4195-8496-(E-Mail Removed)...
> 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 With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      13th Oct 2008
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" <(E-Mail Removed)> wrote in message
news:115F33B6-2197-4195-8496-(E-Mail Removed)...
> 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 With Quote
 
JSnow
Guest
Posts: n/a
 
      30th Jul 2009
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" <(E-Mail Removed)> wrote in message
> news:115F33B6-2197-4195-8496-(E-Mail Removed)...
> > 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trim, LTrim, or RTrim will not remove spaces... kw_uh97 Microsoft Access VBA Modules 5 8th Oct 2009 02:09 AM
Application.Trim with VBA =?Utf-8?B?SmVmZg==?= Microsoft Excel Misc 2 24th Apr 2006 09:18 PM
VBA Trim and Application.worksheetfunction.Trim Hari Prasadh Microsoft Excel Programming 3 19th Jan 2005 02:22 PM
I can't seem to use RTRIM or LTRIM in Excel 2002. I want to trim. =?Utf-8?B?UGFt?= Microsoft Excel New Users 3 2nd Dec 2004 12:08 AM
RTrim help (I think) Gareth Microsoft Access Form Coding 2 23rd Jan 2004 07:41 PM


Features
 

Advertising
 

Newsgroups
 


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