+ Reply to Thread
Results 1 to 3 of 3

text within a string

  1. #1
    Registered User
    Join Date
    10-03-2005
    Posts
    8

    text within a string

    G'day guys, I know there is a simple answer to this. I am searching a column of values and want to stop when I hit a certain string of text. Problem is it will be in larger string.

    example: in the below example I find the load case (say load1) but load1 is in a larger string.

    this is load1
    401
    405
    410
    417
    418
    this is load2
    404
    407
    413
    415
    418
    419

    thanks for your help.

  2. #2
    Jim Cone
    Guest

    Re: text within a string

    n,
    Check out the InStr function in VBA help.
    Jim Cone
    San Francisco, USA
    http://www.realezsites.com/bus/primitivesoftware


    "nelg"
    <[email protected]>
    wrote in message
    news:[email protected]...

    G'day guys, I know there is a simple answer to this. I am searching a
    column of values and want to stop when I hit a certain string of text.
    Problem is it will be in larger string.
    example: in the below example I find the load case (say load1) but
    load1 is in a larger string.

    this is load1
    401
    405
    410
    417
    418
    this is load2
    404
    407
    413
    415
    418
    419

    thanks for your help.
    nelg


  3. #3
    Gary Keramidas
    Guest

    Re: text within a string

    tom just posted this earlier today to help someone out.

    see if it helps you

    Option Explicit
    Dim rng As Range, rng1 As Range
    Dim myVar As String
    Sub test()
    myVar = "this is load1"
    Set rng = Range("a1:a13")

    Set rng1 = rng.Find(myVar)
    If Not rng1 Is Nothing Then
    MsgBox myVar & " found at " & rng1.Address
    Else
    MsgBox myVar & " was not found in " & rng.Address
    End If
    End Sub

    --


    Gary


    "nelg" <[email protected]> wrote in message
    news:[email protected]...
    >
    > G'day guys, I know there is a simple answer to this. I am searching a
    > column of values and want to stop when I hit a certain string of text.
    > Problem is it will be in larger string.
    >
    > example: in the below example I find the load case (say load1) but
    > load1 is in a larger string.
    >
    > this is load1
    > 401
    > 405
    > 410
    > 417
    > 418
    > this is load2
    > 404
    > 407
    > 413
    > 415
    > 418
    > 419
    >
    > thanks for your help.
    >
    >
    > --
    > nelg
    > ------------------------------------------------------------------------
    > nelg's Profile:
    > http://www.excelforum.com/member.php...o&userid=27771
    > View this thread: http://www.excelforum.com/showthread...hreadid=495415
    >




+ 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