Consulting

Results 1 to 3 of 3

Thread: Solved: Find Text

  1. #1
    VBAX Regular
    Joined
    Mar 2012
    Posts
    37
    Location

    Solved: Find Text

    Hi,

    in my column A, i have many strings that will contain the word part or parts but can be anywhere within the string. i need to extract the data after the word part or parts.

    how can i write this in vba?

    thanks

    re

  2. #2
    VBAX Tutor
    Joined
    Jun 2012
    Posts
    269
    Location
    Remy,
    You can use mid and instr to parse the data you want. In the following example, Resultstring will hold the result and findstring is the string you are looking for in the cells. Address should be written (row, column) you are searching through.

    [VBA]ResultString= Mid(Cells(address), InStr(1, Cells(address), FindString) + Len(FindString) + 1)[/VBA]

  3. #3
    VBAX Regular
    Joined
    Mar 2012
    Posts
    37
    Location
    CodeNinja,

    very nice! thanks


    remy

Posting Permissions

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