title: Excel VBA - array used to process ranges changes the format of the cells
body: <p>I am using an array to process the values (and texts) I have in a sheet:</p>
  
  <pre><code>Dim arr As Variant
  
  arr = Application.ActiveSheet.UsedRange
  'do stuff
  Application.ActiveSheet.UsedRange = arr
  </code></pre>
  
  <p>However, this has a side-effect: when dumping the array back into the cells, the cells formatting is changed by Excel's default behaviour. For example, numbers stored as text which start with "0" are converted to numbers, and the "0" gets deleted. Or texts like "1-11" are converted to dates ("November 1"); and probably some others which I have not spotted yet.</p>
  
  <p>If I monitor the Locals window, the strings are being preserved as strings in the array until the very moment, so it is the unloading that messes things up.</p>
  
  <p>Is there a way to avoid this behavior ?</p>
  
  <p>Edit: I also tried: </p>
  
  <pre><code>Application.ActiveSheet.UsedRange.Value = arr
  Application.ActiveSheet.UsedRange.Value2 = arr
  Application.ActiveSheet.UsedRange.text = arr
  </code></pre>
  
  <p>Same result for each.</p>