title: Comparing Strings in VBA
body: <p>I have a basic programming background and have been self sufficient for many years but this problem I can't seem to solve. I have a program in VBA and I need to compare two strings. I have tried using the following methods to compare my strings below but to no avail:</p>
  
  <pre><code>//Assume Cells(1, 1).Value = "Cat"
  
  Dim A As String, B As String
  
  A="Cat"
  
  B=Cell(1, 1).Value
  
  If A=B Then...
  
  If A Like B Then...
  
  If StrCmp(A=B, 1)=0 Then...
  
  I've even tried inputting the Strings straight into the code to see if it would work:
  
  If "Cat" = "Cat" Then...
  
  If "Cat" Like "Cat" Then...
  
  If StrCmp("Cat" = "Cat", 1) Then...
  </code></pre>
  
  <p>VBA for some reason does not recognize these strings as equals. When going through Debugger it shows that StrComp returns 1. Do my strings have different Char lengths? Thanks for any help.</p>