title: Unable to generate constant date formatting vba
body: <p>I am having an issue where dates are generated in completely different ways that have caused error. These errors include years being classified as days and vice versa. It is taking dates formatted as 07-JUN-17 and selecting the first two values as year and last value 17 as day. Additionally First Date read is not overwritten comes out as 2018-1-1 so it is completely different. Any suggestions on how to change to create common date format?</p>
  
  <pre><code>YearA = Range("YearA").Value + 0
  FirstDateRead = DateSerial(YearA + 1, 1, 1)  'Initialize the first Day of the year as the last day
  LastDateRead = DateSerial(YearA, 1, 1)       'Initialize the last Day of the year as the first day
  FirstDateBill = DateSerial(YearA + 1, 1, 1)  'Initialize the first Day of the year as the last day
  LastDateBill = DateSerial(YearA, 1, 1)       'Initialize the last Day of the year as 
  
         'FirstDate
          Report.Cells(LineNum, 5).NumberFormat = "dd-mmm-yy"
          Report.Cells(LineNum, 5).Value = Format(FirstDateBill, "dd-MMM-yy")
          'LastDate
          Report.Cells(LineNum, 6).NumberFormat = "dd-mmm-yy"
          Report.Cells(LineNum, 6).Value = Format(LastDateBill, "dd-MMM-yy")
          'FirstDate
          Report.Cells(LineNum, 7).NumberFormat = "dd-mmm-yy"
          Report.Cells(LineNum, 7).Value = Format(FirstDateRead, "dd-MMM-yy")
          'LastDate
          Report.Cells(LineNum, 8).NumberFormat = "dd-mmm-yy"
          Report.Cells(LineNum, 8).Value = Format(LastDateRead, "dd-MMM-yy")
          'ProratedDays
  </code></pre>