+ Reply to Thread
Results 1 to 8 of 8

Modify a "Split" statement

  1. #1
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,177

    Modify a "Split" statement

    I had help in the past from this forum to make a split statement
    Please Login or Register  to view this content.
    The above takes a cell with data like this:
    "TA(#31," and splits it like this:
    "31"

    Now I have another unique split. Using the same example above but modifying the cell data.
    "TA({#31," and splits it like this: (Added a "{" )
    "{31}" (adding an ending "}" )

    Any hints, tips or examples are appreciated.
    Last edited by Rick_Stanich; 04-05-2011 at 03:37 PM.
    Regards

    Rick
    Win10, Office 365

  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,259

    Re: Modify a "Split" statement

    Hello Rick,

    Here is one way using Regular Expressions. If the number is found between the (# and ), it is returned. Otherwise the cell value is returned unchanged.

    Extract Number Macro
    Please Login or Register  to view this content.
    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 Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,177

    Re: Modify a "Split" statement

    I believe I understand what your function does but I do not think it will output what I need.
    Here is the macro.
    Please Login or Register  to view this content.
    sBubbleNumber is being compared to the value of all cells in Column A for a match, if sBubbleNumber and a cell in column A match then another cell (far right, offset 16 and or 17 cells from A) is populated.

    My mission (haha) is to modify my search from the original code of these two lines:
    Please Login or Register  to view this content.
    To something like this?
    Please Login or Register  to view this content.
    Added opening bracket "{".
    sBubbleNumber would have to be formatted as "{XX}" where XX is a numeric value.

    Looking at this, I think I can do a "Replace" for the "#" with "{" and then add a closing bracket "}"?

  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,259

    Re: Modify a "Split" statement

    Hello Rick,

    Perhaps I misunderstood your post. You are not looking to extract the number from the string "TA({#31" as 31 but as (31)?

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

    Re: Modify a "Split" statement

    Hello Rick,

    This version will extract the number and add the braces to around it. If not it will return the original value.

    Please Login or Register  to view this content.

    You would call it like this ...
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,177

    Re: Modify a "Split" statement

    Quote Originally Posted by Leith Ross View Post
    Hello Rick,

    Perhaps I misunderstood your post. You are not looking to extract the number from the string "TA({#31" as 31 but as (31)?
    The number with opening and closing brackets.
    As {31} (the squiggly brackets, I just can not remember what they are called)

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

    Re: Modify a "Split" statement

    Hello Rick,

    In my last post, I did not have the pound sign in the expression. The code below will place the braces around the number.
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,177

    Re: Modify a "Split" statement

    Thank you Leith, as always your solutions use far less code than mine LOL

+ 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