how to chopp off two final comma

  • Thread starter Thread starter Lim Heng Sin
  • Start date Start date
L

Lim Heng Sin

I have one-dimensional array, myArray. Let said it
contains England, China, Japan. I want it to display in
this way:

England,China,Japan

So, i used the code as follow:

For nIndex = LBound(myArray) to UBound(myArray)

str = str + Trim(myArray(nIndex)) + "'"

Next

But this will return something like that:

England,China,Japan,,

Is there any way to take off the final two commas using
VBA code? What is the function.
 
Lim, tf there are always 2 comma's you can try something like this

str = Left(str,len(str)-2)

HTH
Ed
 
Back
Top