+ Reply to Thread
Results 1 to 3 of 3

begins with, not equals, using activecell.value

  1. #1
    crimsonkng
    Guest

    begins with, not equals, using activecell.value

    What's the VB command, in an Excel macro, to determine if a cell begins with
    certain words?

    Quite frequently, I use the command: If ActiveCell.Value = "Specific Words"
    Then etc.

    But now I want to search for a cell that begins with the words "Up to ..."
    But the rest of the sentence can be 150 different things so it's not
    practical for me to search for every combination of words.

    So, how do I say "if the cell begins with the words 'Up to' Then ...?

    I searched on the web and in Excel "help" and became thoroughly confused.
    Thanks, in advance.

    Dan

  2. #2
    Jim Thomlinson
    Guest

    RE: begins with, not equals, using activecell.value

    Here is one possiblity

    If ActiveCell.Value Like "Up to*" Then MsgBox "Found"

    You could also use InStr function to find the position of a phrase within a
    string...
    --
    HTH...

    Jim Thomlinson


    "crimsonkng" wrote:

    > What's the VB command, in an Excel macro, to determine if a cell begins with
    > certain words?
    >
    > Quite frequently, I use the command: If ActiveCell.Value = "Specific Words"
    > Then etc.
    >
    > But now I want to search for a cell that begins with the words "Up to ..."
    > But the rest of the sentence can be 150 different things so it's not
    > practical for me to search for every combination of words.
    >
    > So, how do I say "if the cell begins with the words 'Up to' Then ...?
    >
    > I searched on the web and in Excel "help" and became thoroughly confused.
    > Thanks, in advance.
    >
    > Dan


  3. #3
    crimsonkng
    Guest

    RE: begins with, not equals, using activecell.value

    Like! I should have known.
    It works perfectly. Thanks.
    Dan

    "Jim Thomlinson" wrote:

    > Here is one possiblity
    >
    > If ActiveCell.Value Like "Up to*" Then MsgBox "Found"
    >
    > You could also use InStr function to find the position of a phrase within a
    > string...
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "crimsonkng" wrote:
    >
    > > What's the VB command, in an Excel macro, to determine if a cell begins with
    > > certain words?
    > >
    > > Quite frequently, I use the command: If ActiveCell.Value = "Specific Words"
    > > Then etc.
    > >
    > > But now I want to search for a cell that begins with the words "Up to ..."
    > > But the rest of the sentence can be 150 different things so it's not
    > > practical for me to search for every combination of words.
    > >
    > > So, how do I say "if the cell begins with the words 'Up to' Then ...?
    > >
    > > I searched on the web and in Excel "help" and became thoroughly confused.
    > > Thanks, in advance.
    > >
    > > Dan


+ 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