Announcement

Collapse
No announcement yet.

Search Cell Containing Character In Vba

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Search Cell Containing Character In Vba

    i just need to find cells containing a certain character. It can be anywhere in the cell. The character is -
    If cl.Value = "=*-*" Then
    If cl.Value = "=-*" Then
    If cl.Value = "*-*" Then
    If cl.Value = "*-" Then
    If cl.Value = "=*-" Then


    Im not sure what the right format is, ive searched cant find it.

    ps i can If cl.Value = "P-X1B" Then
    and the rest of my code and get it to work just fine...

    thanks

  • #2
    Re: Search Cell Containing Character In Vba

    Code:
    If cl.Value Like "*-*" Then
    Christos Lepesiotis

    Comment


    • #3
      Re: Search Cell Containing Character In Vba

      Originally posted by clepe
      Code:
      If cl.Value Like "*-*" Then
      awesome thanks!

      Comment


      • #4
        Re: Search Cell Containing Character In Vba

        how would i do that if i want it to be NOT like

        Comment


        • #5
          Re: Search Cell Containing Character In Vba

          If I understand correct
          Code:
          If cl.Value Like "*-*" Then
              'execute code for "-" existance
          Else
              'execute code for "-" NOT existance
          End If
          Christos Lepesiotis

          Comment


          • #6
            Re: Search Cell Containing Character In Vba

            A much easier way to not include something is with <> instead of an equal sign. I just figured that out figured i would add back to this post.

            Comment

            Working...
            X