+ Reply to Thread
Results 1 to 7 of 7

Macro to truncate string... like "Len,Left,Right formulas"

  1. #1
    Forum Contributor
    Join Date
    01-30-2011
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    604

    Macro to truncate string... like "Len,Left,Right formulas"

    I would like a macro to identify the cell to the right, shorten the string of text and place it in the active cell. I want to snip characters off both the left and right sides.

    I would like a macro to perform as follows:

    Run macro

    Input box: "Enter the number of characters to delete from the left"

    **I'll enter... say "7"

    Input box: "Enter the number of characters to delete from the right"

    **I'll enter... say "4"

    **Then in the active cell it will produce a truncated string.

    Any help appreciated!!
    Last edited by Xx7; 02-28-2011 at 11:17 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Macro to truncate string... like "Len,Left,Right formulas"

    Hello Xx7,

    Will the macro always perform both the left and right truncations together or separately?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    01-30-2011
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    604

    Re: Macro to truncate string... like "Len,Left,Right formulas"

    Quote Originally Posted by Leith Ross View Post
    Hello Xx7,

    Will the macro always perform both the left and right truncations together or separately?
    Hi Leith,

    I believe together would be best

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Macro to truncate string... like "Len,Left,Right formulas"

    Hello Xx7,

    Perhaps this macro will work for what you want to do.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    01-30-2011
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    604

    Re: Macro to truncate string... like "Len,Left,Right formulas"

    Is there anyway to do this for a range of cells, so I don't have to run it for each individual cell. For example, if I have a column filled with strings, I would like to select a bunch of cells in the column, run the macro, and then all the cells to the right of the selected cells would be truncated.

    Sorry, i'm a newb.
    thx

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Macro to truncate string... like "Len,Left,Right formulas"

    Hello Xx7,

    This will ask you to select the range of cells to truncate.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    01-30-2011
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    604

    Re: Macro to truncate string... like "Len,Left,Right formulas"

    thx, problem solved.

+ 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