title: Remove surrounding single quotes from a string in VBA
body: <p>I wrote a simple code below which process string values “words”, if the word has a leading single quote (example: ‘em ) or a trailing one (example: tryin’) or both (example: ‘this’ ) then it removes them , if there are more than one instance of the mark it gets removed too. but if the quote mark is in the middle leave it alone, examples (America's, aren't, can't)</p>
  
  <hr>
  
  <p><strong>How</strong> do I achieve the same function <strong>differently</strong> and <strong>efficiently</strong>? And I don’t want to use a recursive procedure to do it.</p>
  
  <pre><code>Sub RemoveSurroundingSingleQuotes()
      Dim arr(), wrd$
      arr = Array("'wrd1'", "''wrd3''")
      For i = 0 To UBound(arr)
          wrd = arr(i)
          Debug.Print "word before: " &amp; wrd
  RemoveLeft:
          If Left(wrd, 1) = "'" Then wrd = Mid(wrd, 2)
          'check the left side again
          If Left(wrd, 1) = "'" Then GoTo RemoveLeft:
  RemoveRight:
          If Right(wrd, 1) = "'" Then wrd = Mid(wrd, 1, Len(wrd) - 1)
          'check the Right side again
          If Right(wrd, 1) = "'" Then GoTo RemoveRight:
          Debug.Print "word after: " &amp; wrd &amp; vbCr &amp; "--------------"
      Next
  End Sub
  </code></pre>