Consulting

Results 1 to 3 of 3

Thread: Sleeper: Like Function

  1. #1

    Sleeper: Like Function

    HI all,

    I know that if I want to search for a string which contains a word e.g car,
    then I can use like function.. if xTemp.value like "*car*" then......
    however, I want to search for any row which contains exactly the symbol "*",
    how should I write? " if xTemp.value like "*" then...." is not working...

    Thanks a lot!

  2. #2
    VBAX Expert
    Joined
    Feb 2005
    Posts
    929
    Location
    Quote Originally Posted by Dreamer
    HI all,

    I know that if I want to search for a string which contains a word e.g car,
    then I can use like function.. if xTemp.value like "*car*" then......
    however, I want to search for any row which contains exactly the symbol "*",
    how should I write? " if xTemp.value like "*" then...." is not working...

    Thanks a lot!
    Since you are searching for "text", it might make more sense to use xTemp.Text instead of xTemp.Value

    Something like

    If xTemp.Text = "*" then
    should work

    I am assuming that you have declared xTemp as a Range and set xTemp = to the target cell or something similar
    "It's not just the due date that's important, it's also the do date" [MWE]

    When your problem has been resolved, mark the thread SOLVED by clicking on the Thread Tools dropdown menu at the top of the thread.

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by Dreamer
    HI all,

    I know that if I want to search for a string which contains a word e.g car,
    then I can use like function.. if xTemp.value like "*car*" then......
    however, I want to search for any row which contains exactly the symbol "*",
    how should I write? " if xTemp.value like "*" then...." is not working...

    Thanks a lot!
    Like "*[*]*"

    .
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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