+ Reply to Thread
Results 1 to 2 of 2

substring operation

  1. #1
    jana
    Guest

    substring operation

    hi ,
    is there a way to find the n'th instance of a substring in its
    parent string ?

    regards,
    jana


  2. #2
    Zack Barresse
    Guest

    Re: substring operation

    Hi, here are a couple of examples that may help ...


    Sub FindReplaceNthVal()
    Dim strLook As String
    Dim strFind As String
    Dim lngInst As Long
    Dim strFinal As String
    strLook = "again1again2again3again4again5again6again7again8"
    strFind = "again"
    lngInst = 4
    strFinal = WorksheetFunction.Substitute(strLook, strFind, "", lngInst)
    MsgBox strFinal
    End Sub
    Sub FindNthPosition()
    Dim strLook As String
    Dim strFind As String
    Dim lngInst As Long
    Dim lngPos As Long
    Dim strFinal As String
    Dim strWhole As String
    strLook = "again1again2again3again4again5again6again7again8"
    strFind = "again"
    lngInst = 4
    strFinal = WorksheetFunction.Substitute(strLook, strFind, "~", lngInst)
    lngPos = InStr(1, strFinal, "~")
    strWhole = Mid(strLook, lngPos, Len(strFind))
    End Sub


    HTH

    --
    Regards,
    Zack Barresse, aka firefytr, (GT = TFS FF Zack)
    To email, remove the NO SPAM. Please keep correspondence to the board, as
    to benefit others.



    "jana" <[email protected]> wrote in message
    news:[email protected]...
    > hi ,
    > is there a way to find the n'th instance of a substring in its
    > parent string ?
    >
    > regards,
    > jana
    >




+ 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