+ Reply to Thread
Results 1 to 6 of 6

VB Code to split the text String

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB Code to split the text String

    Hello:

    I have text string "Z1/Groups /12-22-2013/01:09" in cell A7.
    I need a VB Code ( would need VB Code and not formula) to split the above as follows:

    Cell F7 : "Z1/Groups"
    Cell G7 : "12-22-2013"
    Cell H7 : "01:09"

    Please help and let me know if any questions.

    Thank you.

    Riz Momin

  2. #2
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: VB Code to split the text String

    Hi Riz, what are the criteria for splitting the text? (e.g. what's the decision that makes "Z1/Groups" split to column F?)
    Could you share more samples?
    Is the length of date/time consistent across your data? (i.e. dd-mm-yyyy/hh:mm)

  3. #3
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to split the text String

    Hello:

    The file will have text string in this format always : "Z1/Groups /dd-mm-yyyy/hh:mm"

    Please let me know if any questions.

    Riz Momin

  4. #4
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: VB Code to split the text String

    Try:

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to split the text String

    Hello:

    I am now using below code but it is erroring out.
    Please help...I have attached sheet.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    12-25-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2016
    Posts
    506

    Re: VB Code to split the text String

    Hi Riz, both arr1 and arr2 are arrays.
    If you prefer to declare them, try:

    Please Login or Register  to view this content.

+ 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. Advanced Split Function: Need to pull text string in quotes, within a text string
    By Zamboni in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-27-2013, 04:38 PM
  2. [SOLVED] Formula to Split up string of text
    By kenadams378 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-04-2013, 05:43 AM
  3. Split text string into four cells
    By mkvassh in forum Excel General
    Replies: 13
    Last Post: 03-02-2012, 09:16 AM
  4. UDF to Split Text String
    By cdrhodes in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-28-2010, 03:40 PM
  5. Split text string to different columns
    By liarliar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2008, 09:13 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