title: VBA compare string ( check if string one contains string 2)
body: <p>I am having a problem with comparing two strings. The method does not seem to work somehow. I have tried the following to functions: </p>
  
  <ol>
  <li><p>Method: </p>
  
  <pre><code>If StrComp(logic_string, RSTA_ISIN_clean) Then
      rng.Offset(0, 16) = "OK(ISIN in RSTA)"
      rng.Offset(0, 16).Interior.Color = 5296274
  Else
      rng.Offset(0, 16) = "NG(ISIN not RSTA or check RSTA)"
      rng.Offset(0, 16).Interior.Color = 255
  End If
  </code></pre></li>
  <li><p>Method: </p>
  
  <pre><code> If InStr(1, RSTA_ISIN_clean, logic_string, vbTextCompare) Then
       rng.Offset(0, 16) = "OK(ISIN in RSTA)"
       rng.Offset(0, 16).Interior.Color = 5296274
   Else
       rng.Offset(0, 16) = "NG(ISIN not RSTA or check RSTA)"
       rng.Offset(0, 16).Interior.Color = 255
   End If
  </code></pre></li>
  </ol>
  
  <p>in logic_string I have the value "FR0012915700" and in RSTA_ISIN i have the value = " Old ISIN: FR0012915700"</p>
  
  <p>All I am trying to do is to check if  RSTA_ISIN  is in logic_string and if so i want to write OK in cell. (trying to get a contains method here)</p>
  
  <p>It can be that something is wrong with logic_string as it sometimes gives me spaces -> so logic_string looks like this in debug mode "   FR0004052561" -> I tried to trim the spaces with Trim but that doesn't work either. </p>
  
  <p>I have also tried the InStr function but that doesn't work either</p>
  
  <p>Can someone assist please</p>
  
  <p>This is what I get in debug mode: </p>
  
  <p><a href="https://i.stack.imgur.com/p0lbn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p0lbn.png" alt="enter image description here"></a></p>