+ Reply to Thread
Results 1 to 2 of 2

how to retreive a object between two spaces in a string

  1. #1
    Registered User
    Join Date
    02-18-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1

    Exclamation how to retreive a object between two spaces in a string

    need urgent help

    i have textbox on a userform where i need to retreive an object form a string between two spaces

    for eg the string is test sample test1 sample1

    i need an excel vba code to get sample or test1 from the string in the text box

    thanx in advance

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: how to retreive a object between two spaces in a string

    you can use the SPLIT function, an example below

    Sub test()

    strtest = "test sample test1 sample1"

    Dim aSplit() As String

    aSplit = Split(strtest, Chr(32))

    MsgBox aSplit(0)
    MsgBox aSplit(1)
    MsgBox aSplit(2)
    MsgBox aSplit(3)

    End Sub

+ 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