+ Reply to Thread
Results 1 to 5 of 5

Trim Values of a Cell

  1. #1
    Forum Contributor
    Join Date
    11-02-2010
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    353

    Trim Values of a Cell

    Hi!
    Could you recommend a Macro that can trim contents of a Cell?
    What Im trying to achieve is to create a VBA Macro to trim a Cell, leave only the text following "O:"

    On Cell A1 I have this value:
    "Location: C:\Test Folders O: Trevayne, Andrew"

    I'd like this to be trimmed and have a return value on A2
    Trevayne, Andrew

    Can this be done via VBA and not by Formula?


    Cheers,
    Andrew
    Last edited by Andrew.Trevayne; 10-10-2011 at 04:29 AM.

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Trim Values of a Cell

    Maybe:

    =MID(A4,SEARCH("O:",A4,1),2)

    Why do you want to do this via VBA? Formulas are faster

  3. #3
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Trim Values of a Cell

    with VBA try this

    Please Login or Register  to view this content.
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Trim Values of a Cell

    As a VBA function:


    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    11-02-2010
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    353

    Re: Trim Values of a Cell

    Perfect! Just the way I wanted it! Thank you so much sir. ^^

+ 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