+ Reply to Thread
Results 1 to 3 of 3

space in string

  1. #1
    Registered User
    Join Date
    11-05-2010
    Location
    london, england
    MS-Off Ver
    Excel 2003
    Posts
    59

    space in string

    i try to add some strings together using the syntax: string1 & string2
    however, there are always space inbetween them. e.g. string1=abcd string2=efg
    string1 &string2 always give me "abcd efg" instead of "abcdefg"
    any idea how can i get rid of the space?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: space in string

    Try

    =Trim(string1)&Trim(string2)

    I suspect there may be a trailing space on your first string , and possibly the second string.

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: space in string

    Hi!
    It looks like there is a leading or/and trailing space in (at least) one of the strings.
    You can use Trim to get rid of leading trailing space. There is worksheet function Trim and also VBA functions TRim, LTrim and RTrim.

    Buran
    If you are pleased with a member's answer then use the Star icon to rate it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1