Results 1 to 3 of 3

Thread: Find and grab a substring in Excel

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2000
    Posts
    25

    Question Find and grab a substring in Excel

    Ok, quick question, I am attempting to find a chunk of text in a string and place that chunk into its own string.

    So say I have
    "This is my string"

    and I want to grab "my" out of the bunch and stick it in another string.

    This wouldn't be a prob... However, the string varies and sometimes "my" is not going to exist.

    Any suggestions, I had thought at first just loop thru till " " was encountered then read first letter, see if its what I want, if not go to next word, etc...

    Tho dunno how the heck to do this in VB(somewhat VB handicapped

    Any quickie suggestions? Seems fairly easy, but I can't really think of a non sadistic way of taking it.
    Mark Wight
    x86 ASM, AS11 ASM, C, C++, Java.

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Oct 2000
    Posts
    25

    Erh, quick addition

    The string might also be "and so this my string" still want to get "my"
    Mark Wight
    x86 ASM, AS11 ASM, C, C++, Java.

  3. #3
    Fanatic Member InvisibleDuncan's Avatar
    Join Date
    May 2001
    Location
    Eating jam.
    Posts
    819
    Code:
    MsgBox InStr("This is my string", "my")
    Returns 0 if it doesn't find it, otherwise returns the position at which it was found.
    Indecisiveness is the key to flexibility.

    www.mangojacks.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width