+ Reply to Thread
Results 1 to 3 of 3

Trimming non-alphanumeric characters instead of spaces (LTrim/RTrim)

  1. #1
    Registered User
    Join Date
    09-14-2011
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    66

    Trimming non-alphanumeric characters instead of spaces (LTrim/RTrim)

    Hello,

    I am a VBA beginner. I am trying to take out any non-alphanumberic characters from a text string but only if they are at the beginning or the end of the string.

    I tried LTrim and RTrim but it seems that only works for spaces, so I am wondering if there is some thing similar to do what I need?

    Thanks,

    Soph

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Trimming non-alphanumeric characters instead of spaces (LTrim/RTrim)

    Hi,

    Is there a definitive list of the non alphanumeric characters you're interested in?
    Can these characters exist within the string.
    Are there any delimiting characters (like say a space) which identifies the start or end of the alphanumeric chars.?

    Would you upload a sample workbook that contains examples of typical strings. This often helps.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    09-14-2011
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    66

    Re: Trimming non-alphanumeric characters instead of spaces (LTrim/RTrim)

    I can't work out how to upload a sample sorry, I'll try to explain best I can...

    What I have currently is a list of names and addresses with the full address in one cell and the city, state, postcode and country are then alongside in separate cells. Because I already have city, state etc. separate I can use a SUBSTITITE function to take those out, leaving me with just the first part of the address and then I want to split that into two cells (Address1 and Address2).

    Sometimes the address which is all in one cell starts or ends with a blank line so I first want to strip out char(10) but only at the beginning and end of the string. After that I want to have Address1 as being everything to the left of the first char(10) and Address2 as everything to the right and replacing char(10) with a comma.

    Does my waffle make sense???

    Thanks,
    Attached Images Attached Images

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Combining Fields - A Little Too Much Trimming of Spaces
    By SpeakingPeace in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-17-2013, 04:07 PM
  2. Replies: 3
    Last Post: 04-23-2012, 10:18 AM
  3. Trimming cells (not spaces)
    By TheRetroChief in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 10-20-2008, 12:46 PM
  4. Trimming Spaces before and after
    By maurices5000 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-09-2008, 04:48 PM
  5. Trimming Alphanumeric String
    By sagacious2 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-19-2006, 03:45 AM

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