title: VBA, if a string contains a certain letter
body: <p>I do not usually work with <code>VBA</code> and I cannot figure this out.  I am trying to determine whether a certain letter is contained within a string on my spreadhseet.</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  Dim myString As String
  RowCount = WorksheetFunction.CountA(Range("A:A"))
  MsgBox RowCount
  For i = 2 To RowCount
      myString = Trim(Cells(i, 1).Value)
      If myString.Contains("A") Then
          oldStr = Cells(i, 15).Value
          newStr = Left(oldStr, oldStr.IndexOf("A"))
      End If
  Next          
  End Sub
  </code></pre>
  
  <p>This code should go through a list of values and if it encounters the letter A to remove it and everything that comes after it.  I am getting problems at my <code>IF</code> statement, Invalid Qualifier.  How would I be able to make my <code>IF</code> statement output whether or not the String in the cell contains the letter A?</p>
  
  <p>Thank you very much</p>