+ Reply to Thread
Results 1 to 5 of 5

Trim spaces before and after string in cell

  1. #1
    Registered User
    Join Date
    06-20-2013
    Location
    Bratislava
    MS-Off Ver
    MS EXCEL 2021
    Posts
    90

    Trim spaces before and after string in cell

    Hi all & Hahobe,

    Could you take me advice how to trim spaces before and after string in cell? Range is one column.

    Something similar as:

    Please Login or Register  to view this content.
    But in this time i need to keep full string and remove spaces before and after ( AAAA, BBBB )
    PS: Between words need to keep same condition - means with space
    Last edited by xbr088; 07-03-2013 at 01:09 PM.

  2. #2
    Registered User
    Join Date
    10-07-2012
    Location
    Richmond, VA USA
    MS-Off Ver
    2010
    Posts
    10

    Re: Trim spaces before and after string in cell

    For me I simply use the Trim() function. It removes the leading and trailing spaces but leaves all other spaces in places.
    If I helped, please click the star below the post.

  3. #3
    Registered User
    Join Date
    06-20-2013
    Location
    Bratislava
    MS-Off Ver
    MS EXCEL 2021
    Posts
    90

    Re: Trim spaces before and after string in cell

    Thanks, and how to wrote ? only
    Please Login or Register  to view this content.
    ?

  4. #4
    Registered User
    Join Date
    10-07-2012
    Location
    Richmond, VA USA
    MS-Off Ver
    2010
    Posts
    10

    Re: Trim spaces before and after string in cell

    The format would be something like the below.
    Please Login or Register  to view this content.
    Looking back through your original post I saw that you said that the "Range is one column".

    Are you trying to concatenate multiple cells together? The trim function itself only works with a single string variable or cell. If you are trying to concatenate multiple cells in a single column together, that will require additional coding beyond the Trim() function. Am I reading too much into your first post?

  5. #5
    Registered User
    Join Date
    06-20-2013
    Location
    Bratislava
    MS-Off Ver
    MS EXCEL 2021
    Posts
    90

    Re: Trim spaces before and after string in cell

    Thanks VBA Grunt, easy solution for my problem.

+ 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