title: Sort Range by Date Value in Column
body: <p>The following code below execute fine but the output of the sort function is a mess.</p>
  
  <p>Intention of code is to sort range of values from B2 to last row of L
  According to DD/MM/YYYY HH:MM:SS value </p>
  
  <p><strong>Code is used to sort a series of files in a folder, so a simple macro recording won't suffice</strong></p>
  
  <pre><code> Dim Slrow As Long
  'Updated last row count to Column B from comment made
  Slrow = Cells(Rows.Count, 2).End(xlUp).Row
  
      Range("B2:L" &amp; Slrow).Sort Key1:=Range("B2:L" &amp; Slrow), Order1:=xlAscending, Header:=xlNo
  
  
    SortWb.Close SaveChanges:=True
  </code></pre>
  
  <p><strong>Output of Code</strong>
  <a href="https://i.stack.imgur.com/kmgXx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kmgXx.png" alt="Output of code"></a></p>
  
  <p>File Download link available below ->
  <a href="https://www.dropbox.com/s/maslfi0jan3wyhm/Test.csv?dl=0" rel="nofollow noreferrer">Download</a></p>
  
  <p>Sorting with Custom Sort</p>
  
  <p><a href="https://i.stack.imgur.com/sDph7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sDph7.png" alt="enter image description here"></a></p>