title: Inserting a line return in Excel VBscript / VBA
body: <p>Using Excel v16</p>
  
  <p>I'm trying to format text in a cell by replacing a character like tilde ~ with a carriage return whereby the finished result would be multiple lines. This is actually a merged cell of multiple rows and columns as shown below</p>
  
  <p>This is the input
  <a href="https://i.stack.imgur.com/kBQDy.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kBQDy.gif" alt="enter image description here"></a></p>
  
  <p>This is the desired output
  <a href="https://i.stack.imgur.com/ORx3G.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ORx3G.gif" alt="enter image description here"></a></p>
  
  <p>Here is the script I'm using in my macro</p>
  
  <pre><code>Sub FindReplaceAll()
      Sheets("Template").Select
      Range("A34").Select
  
      iStr = ActiveCell.Value
  
      For i = 1 To Len(iStr)
          If Mid(iStr, i, 1) = "~" Then
              rtStr = rtStr + vbCr
      Else
          rtStr = rtStr + Mid(iStr, i, 1)
      End If
  
      Next i
  
      ActiveCell.Value = rtStr
  
  End Sub
  </code></pre>
  
  <p>Unfortunately all I get is same line with the tilde removed
  The cell is formatted with the wrap text.  Not sure where to go from here.</p>