title: Convert Text to Date?
body: <p>I have a column of dates (column A) stored as text in the format <code>yyyy-mm-dd</code> which I'm trying to convert to dates, ultimately so that I can do look ups against them.</p>
  
  <p>I've read a few topics on here and tried some of the suggestions, but I can't get anything to work. One was using:</p>
  
  <pre><code>Columns("A").Select
  Selection.NumberFormat = "date"
  </code></pre>
  
  <p>This changed the format of the cells to date but didn't actually change the format of the value which was still stored as text.</p>
  
  <p>My understanding is that I need to use CDate() to change the format of the value from text to date. I've tried something like this:</p>
  
  <pre><code>Dim c As Range
  For Each c In ActiveSheet.UsedRange.columns("A").Cells
      c.Value = CDate(c.Value)
  Next c
  </code></pre>
  
  <p>Which gives me a type mismatch error. I wondered if this was because I was trying to save date values back into a non-date formatted cell so I tried combining it with the .NumberFormat = "date" above, which didn't work either.</p>
  
  <p>Any suggestions would be appreciated.</p>