+ Reply to Thread
Results 1 to 3 of 3

How to break up a text string?

  1. #1
    Registered User
    Join Date
    10-18-2006
    Posts
    5

    How to break up a text string?

    I've used CONCATENATE for a long time. Now I need to grab certain sections of strings between sets of delimeters. I was hoping to find a nice simple command to do this but may need to create a macro.

    Is it macro or some text function that I'm overlooking?

    Thanks!

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    You can use a formula but a macro might be better if you do it often.

    Can you post an example of your data and what the delimiter is ??

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    10-18-2006
    Posts
    5

    Macro was easy to build

    I just built a macro almost exactly from the Walkenbach text for extracting the field I needed and here it is for anyone who needs a similar tool:

    'This Excel custom macro has been developed by SG Systems [www.sgsystems.com]
    'No warranty or guarantee, implicit or explicit, is provided

    Option Explicit


    Public Function SGSYS_STRINGSPLIT(TXT_STRING, FIELD_NUMBER, DELIMITER) As String

    Application.MacroOptions Macro:="SGSYS_STRINGSPLIT", Category:=14
    Application.MacroOptions _
    Macro:="SGSYS_STRINGSPLIT", _
    Description:="STRINGSPLIT macro returns element from FIELD_NUMBER"

    'varible declarations

    Dim FINAL As Variant

    'constant setup

    FINAL = 0

    'function area

    FINAL = Split(TXT_STRING, DELIMITER)

    SGSYS_STRINGSPLIT = FINAL(FIELD_NUMBER - 1)

    End Function

+ 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