title: Excel (VBA): data formatted as date not recognized
body: <p>So I have an excel file, with some VBA code in it. The problematic bit is that I need to sort a lot of data by barcode number first, then by Date of visit (each barcode visits multiple times). </p>
  
  <p>This all works fine with random test data that I generated. It gets all sorted by barcode, then by date from latest to earliest.Great!</p>
  
  <p>But not, when I try to use actual data, it doesn't: the barcode gets sorted all right but not the date. The actual data will come from an Android app (Xscan) that has <strong>CSV files as output</strong>.</p>
  
  <p>Unfortunately, the data exports looks like this "21/10/2014". When I try to have it sorted, it only sorts it according to the very first number, not as a date (not very useful)... so no matter what the month is, if the day is 31 st, it'll be place highest.</p>
  
  <p>I have tried the following: changing datatype back &amp; forth, and run the code with datatype set to different things, but it still doesn't work.</p>
  
  <p>****How can I make Excel understand that <strong>21/10/2014</strong> is to be read as a date, even though it comes from a CSV file and looks like a string/weird division?****</p>
  
  <p>Ideally, the solution could be coded into VBA somehow... I'm dealing with very low-tech skills users.... </p>
  
  <p>EDIT: See screenshot below: the column I need to sort by is column H. It doesn't matter if I set data type to Number, date, general.... Still does the same. As for the code:</p>
  
  <pre><code>Function sorting_all(mySheet As Worksheet, myRangeRow As Range, myRangeCol As Range, secondSort As String)
  Dim myCol As Range
  Set myCol = getCol(mySheet, secondSort)
  mySheet.Range("A1", mySheet.Cells(myRangeRow.Row, myRangeCol.Column)).Sort key1:=mySheet.Range("A1"), order1:=xlAscending, key2:=mySheet.Range(Columns(myCol.Column).Address()), order2:=xlDescending, Header:=xlYes, Orientation:=xlSortColumns
  
  End Function
  </code></pre>
  
  <p>The barcode is in column A and always will be, hence the hardcode (I know I know). That's the key1. Key2 is the date of visit (though the function is called to sort other things, hence the secondsort variabel).</p>
  
  <p><img src="https://i.stack.imgur.com/SsGUO.png" alt="enter image description here"></p>
  
  <p>Further EDIT: So apparently the output file from the application isn't really saved as a .CSV (even though that's what the app claims), it is saved as a Excel 97-2003 file. If I copy-past from that file, it doesn't work. If I saved the file as a CSV (properly), THEN copy-past from it.... it works. Not gonna lie, I hate Excel. Not built-in function to change this from the app. So the heart of the matter might be between the Excel 97-2003 file format &amp; my Excel 2010 file that I use... In any case it does seem that importing the data through VBA will be the best answer.</p>