title: How to compare string from cell with string from inputBox()
body: <p>I have a spread sheet that look like so:</p>
  
  <pre><code>Group   | Name   | Title
  -----------------------------------
  X         WS       -
  X         DH       -
  X         M        -
  X         DH       -
  X         WS       -
  </code></pre>
  
  <p>I want to loop through all the cells in name and replace the initial there with their full name in addition to adding the correct title. My script is <strong>failing to accurately compare the strings and go into the if-statement</strong>:</p>
  
  <pre><code>Sub enterNameAndTitle()
  
      lastCell = InputBox("Last cell")
      rInitials = InputBox("Initials")
      rFullName = InputBox("Full Name")
      rTitle = InputBox("Title")
  
      Dim cell As Range
  
      For Each cell In Range("b2:b" &amp; lastCell).Cells
  
          MsgBox (cell.Text &amp; " : " &amp; rInitials)
  
          If StrComp(UCase(cell.Value), UCase(rInitials)) = 0 Then
              cell.Value = rFullName
              ActiveSheet.Cells(cell.Row, cell.Column + 1).Value = rTitle
          End If
  
      Next cell
  
  End Sub
  </code></pre>
  
  <p>So I first collect the data and then loop through all the values. Does anyone know what I am doing incorrectly? Why doesn't it compare the string accurately?</p>