+ Reply to Thread
Results 1 to 3 of 3

semicolon delimiter in a cell

  1. #1
    coco
    Guest

    semicolon delimiter in a cell

    In a cell I have this values

    ;1,LPT,23;2,5;DD;5,5;ABC;6,5; etc......

    How can I, using VB assign to an array-variable;
    (semicolon delimiter ";")

    Thanks

    Coco



  2. #2
    Bob Phillips
    Guest

    Re: semicolon delimiter in a cell

    Dim ary

    ary = Split(ActiveCell.Value, ";")

    --
    HTH

    Bob Phillips

    "coco" <[email protected]> wrote in message
    news:[email protected]...
    > In a cell I have this values
    >
    > ;1,LPT,23;2,5;DD;5,5;ABC;6,5; etc......
    >
    > How can I, using VB assign to an array-variable;
    > (semicolon delimiter ";")
    >
    > Thanks
    >
    > Coco
    >
    >




  3. #3
    Dave Peterson
    Guest

    Re: semicolon delimiter in a cell

    Something like...

    Option Explicit
    Sub testme()

    Dim myVal As String
    Dim mySplit As Variant
    Dim iCtr As Long
    myVal = ActiveSheet.Range("a1").Value

    mySplit = Split(myVal, ";")
    'mySplit = Split97(myVal, ";")

    For iCtr = LBound(mySplit) To UBound(mySplit)
    Debug.Print iCtr & "--" & mySplit(iCtr)
    Next iCtr

    End Sub
    'from Tom Ogilvy
    Function Split97(sStr As String, sdelim As String) As Variant
    Split97 = Evaluate("{""" & _
    Application.Substitute(sStr, sdelim, """,""") & """}")
    End Function

    =====
    Split was added in xl2k. If you're using xl97, use Tom's Split97.

    coco wrote:
    >
    > In a cell I have this values
    >
    > ;1,LPT,23;2,5;DD;5,5;ABC;6,5; etc......
    >
    > How can I, using VB assign to an array-variable;
    > (semicolon delimiter ";")
    >
    > Thanks
    >
    > Coco


    --

    Dave Peterson

+ 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