View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John Keith John Keith is offline
external usenet poster
 
Posts: 172
Default trim not working

I'm having some difficulty making the trim function work.

I pull some data from a server and occassionally that data will be
padded with extra characters at the end of the string, including both
chr(32) and chr(160). I have successfully removed the chr(160) using
the replace fucntion:

variable = replace(variable,chr(160),"")

and I'm trying to use trim to remove the spaces:

variable = trim(variable)

but the space remains.

I have tried rtrim (the padding always seems to be at the end of the
string) and I also tried the following:

variable = trim(str(variable))

and with this line of code I get a "type mismatch" error message, so
I'm thinking that my data is not appearing to be a string.

Do I need to fomat the cells where this data is loaded as text.

I'm at my wits end trying to figure this out, please share your
experience!


John Keith