+ Reply to Thread
Results 1 to 5 of 5

Need a property that will give me true if a value is close

  1. #1
    havocdragon
    Guest

    Need a property that will give me true if a value is close

    Ok so heres what im saying:

    Lets say I have a value in a cell "Price"

    If I put a value of "If activecell = "Price" then"

    This will be a valid statement and do what I tell it to afterwards. However,
    lets say the value in the cell is " Price" or "$Price" how would I make a
    statment saying something to the effect of "If activecell = similar to
    "Price" then"



  2. #2
    Jim Thomlinson
    Guest

    RE: Need a property that will give me true if a value is close

    Try the InStr function. It returns the starting point of one string in the
    other . If the string is not found then it returns zero.

    if Instr(activecell.Value, "Price")>0 then
    ....

    HTH

    "havocdragon" wrote:

    > Ok so heres what im saying:
    >
    > Lets say I have a value in a cell "Price"
    >
    > If I put a value of "If activecell = "Price" then"
    >
    > This will be a valid statement and do what I tell it to afterwards. However,
    > lets say the value in the cell is " Price" or "$Price" how would I make a
    > statment saying something to the effect of "If activecell = similar to
    > "Price" then"
    >
    >


  3. #3
    Bob Phillips
    Guest

    Re: Need a property that will give me true if a value is close

    Like should do it. For Example

    If Activecell.Value Like "*Price*" Then
    ....

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "havocdragon" <havocdragon@discussions.microsoft.com> wrote in message
    news:33C12D0A-FDDA-43E4-A2E6-D4FB4A152FD3@microsoft.com...
    > Ok so heres what im saying:
    >
    > Lets say I have a value in a cell "Price"
    >
    > If I put a value of "If activecell = "Price" then"
    >
    > This will be a valid statement and do what I tell it to afterwards.

    However,
    > lets say the value in the cell is " Price" or "$Price" how would I

    make a
    > statment saying something to the effect of "If activecell = similar to
    > "Price" then"
    >
    >




  4. #4
    Jim Thomlinson
    Guest

    Re: Need a property that will give me true if a value is close

    Haven't seen you in a few days. As always I am going to be difficult and ask
    if one way is faster than the other... :-)

    "Bob Phillips" wrote:

    > Like should do it. For Example
    >
    > If Activecell.Value Like "*Price*" Then
    > ....
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "havocdragon" <havocdragon@discussions.microsoft.com> wrote in message
    > news:33C12D0A-FDDA-43E4-A2E6-D4FB4A152FD3@microsoft.com...
    > > Ok so heres what im saying:
    > >
    > > Lets say I have a value in a cell "Price"
    > >
    > > If I put a value of "If activecell = "Price" then"
    > >
    > > This will be a valid statement and do what I tell it to afterwards.

    > However,
    > > lets say the value in the cell is " Price" or "$Price" how would I

    > make a
    > > statment saying something to the effect of "If activecell = similar to
    > > "Price" then"
    > >
    > >

    >
    >
    >


  5. #5
    Bob Phillips
    Guest

    Re: Need a property that will give me true if a value is close

    Hi Jim,

    Been charging around France for the past ten days,, from the Northern ports,
    to the High Alps, to the sunny South-West and back. Far too hectic to hit
    the groups ...

    In all my tests, as I expected, Instr tends to be faster, by about 2 times .
    So where speed is important, Instr it is, but otherwise I think Like is more
    intuitive, and reads better.

    Regards

    Bob

    "Jim Thomlinson" <JimThomlinson@discussions.microsoft.com> wrote in message
    news:64DBB5E0-A3E3-4E06-A5E6-7BF9609A344D@microsoft.com...
    > Haven't seen you in a few days. As always I am going to be difficult and

    ask
    > if one way is faster than the other... :-)
    >
    > "Bob Phillips" wrote:
    >
    > > Like should do it. For Example
    > >
    > > If Activecell.Value Like "*Price*" Then
    > > ....
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "havocdragon" <havocdragon@discussions.microsoft.com> wrote in message
    > > news:33C12D0A-FDDA-43E4-A2E6-D4FB4A152FD3@microsoft.com...
    > > > Ok so heres what im saying:
    > > >
    > > > Lets say I have a value in a cell "Price"
    > > >
    > > > If I put a value of "If activecell = "Price" then"
    > > >
    > > > This will be a valid statement and do what I tell it to afterwards.

    > > However,
    > > > lets say the value in the cell is " Price" or "$Price" how would I

    > > make a
    > > > statment saying something to the effect of "If activecell = similar to
    > > > "Price" then"
    > > >
    > > >

    > >
    > >
    > >




+ 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