title: Remove Leading and Trailing Whitespace from Excel Cells
body: <p>I have an Excel spreadsheet with several cells that have leading or trailing whitespace (including spaces, non-breaking spaces, carriage returns, and new lines). I want to remove these white spaces. My Google searching suggests this can only be done with VBA. The VBA <a href="https://msdn.microsoft.com/en-us/library/h9wz3dez(v=vs.90).aspx" rel="nofollow">Trim</a> function doesn't remove all types of whitespaces and may remove from the middle of the cell as well. The MSDN page for VBA's Trim function references .NET's <a href="https://msdn.microsoft.com/en-us/library/t97s7bs3(v=vs.90).aspx" rel="nofollow">String.Trim</a> method which does exactly what I want. However, I'm not sure how to call String.Trim from VBA as suggested by the first link. How do I call the String.Trim method from Excel VBA?</p>
  
  <p>EDIT: To clarify, I want to keep the whitespace (including carriage returns and new lines) in the middle of the cell. I only want to remove the characters from the beginning and the end of the cell.</p>