View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default Remove the right most 3 characters from a string

You are getting an error on the RIGHT function because you are not passing it
the first argument it needs, which is the string to examine. However, your
approach wouldn't work anyway, because the TRIM function only removes leading
& trailing spaces from a string. Try:

ArrayString = Left(ArrayString, Len(ArrayString) - 3)

Hope this helps,

Hutch

"Jonathan Brown" wrote:

I'm using a loop to build a string of characters but I'm getting extra
characters at the end that I don't want. Is there a function like trimend or
regexp where I can take the string and remove the right most 3 characters?

Here's an example:

arraystring = "someword", "someword2", "someword3", "someword4", "

I'd like it to change my arraystring to show just:

"someword", "someword2", "someword3", "someword4"

This doesn't seem to work for me:
ArrayString = Trim(ArrayString, Right(Len(ArrayString) - 3))

I'm getting an error under the right() function.