+ Reply to Thread
Results 1 to 4 of 4

VBA String Split after certain amount of the same delimeter

  1. #1
    Registered User
    Join Date
    01-21-2013
    Location
    Rustenburg
    MS-Off Ver
    2007
    Posts
    9

    VBA String Split after certain amount of the same delimeter

    How can I split a string in VBA after a certain amount of the same delimeter ?

    For example : {"Josh","Green"},{"Peter","John"}.

    Here I would like {"Josh","Green"} as the first record in an array and {"Peter","John"} as the second. I want to avoid parsing the string character by character. Thx for any help.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: VBA String Split after certain amount of the same delimeter

    You could split at one character after the '}' perhaps?

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: VBA String Split after certain amount of the same delimeter

    one way would be to replace the shared delimiter with a unique one.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  4. #4
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: VBA String Split after certain amount of the same delimeter

    An alternate approach...(assumes {"Josh","Green"},{"Peter","John"} exists in Cell "C3")

    Please Login or Register  to view this content.
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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