title: Vba defaulting Varianel date to 12:00am causing subscript out of range error
body: <p>VBA is defaulting my variable date from user input to 12:00am, which results in a subscript out of range error later on. I have declared all the variables correctly, it was working previously but now it is not. Any ideas on what to check for?  Ive tried adjusting things using DateAdd and as well as trying to get vba to add # to both ends of the variable setting line. The strange thing is, that before now vba was accepting the user input of the date (LastEndDateV) and passing it correctly. Is there something whacky going on with the loop?</p>
  
  <p>I guess its worth mentioning that the user input is from a text box from a user form, however this has not been an issue until now. </p>
  
  <p>sample code</p>
  
  <pre><code> Dim BlockEnd As Date: Dim BlcokStart As Date
   Dim LastStartV As Date
   Dim LastEndDateV As Date
   Dim UACFArray(3, 1) As Date
  
   LastEndDateV = LastEndDateV.Value
   BlcokStart = LastEndDateV + 7
   BlockEnd = LastEndDateV + BlockLength
   TotalC = CSched
   TotalW = WSched
   CareerComb = CareerTypeCombo.Value
   Debug.Print "Values"; BlcokStart, BlockEnd, TotalC, TotalW
  
   UACFArray(0, 0) = #1/6/2015#: UACFArray(0, 1) = #2/3/2015#
   UACFArray(1, 0) = #1/20/2015#: UACFArray(1, 1) = #2/17/2015#
   UACFArray(2, 0) = #2/10/2015#: UACFArray(2, 1) = #3/10/2015#
   UACFArray(3, 0) = #2/24/2015#: UACFArray(3, 1) = #3/24/2015#
  
  For i = LBound(a) To UBound(a)
      If CFChk = True Then
          Select Case CareerComb
          Case Is = "Test1", "Test2"
              For l = LBound(UACFArray, 1) To UBound(UACFArray, 1)
                  If BlcokStart = UACFArray(l, 0) Then
                      For m = LBound(UACFArray, 2) To UBound(UACFArray, 2)
                          BlockEnd = UACFArray(l, m)
                          a(i) = BlcokStart &amp; " &amp; " &amp; BlockEnd
                          TotalC = TotalC + 3
                          TotalW = TotalW + CWs
                          BlcokStart = UACFArray(l + 1, 0) ******subscript occurs here
                      Next m
  </code></pre>
  
  <p>Here is what I tested it with initially before moving it into the main part of my original code:  </p>
  
  <pre><code>Sub loopchecker()
  
  Dim UACFArray(8, 1) As Date
  Dim checkpoint As Date
  Dim Block As String
  
  checkpoint = #2/11/2015#
  
  UACFArray(0, 0) = #1/6/2015#: UACFArray(0, 1) = #2/3/2015#
  UACFArray(1, 0) = #1/20/2015#: UACFArray(1, 1) = #2/17/2015#
  UACFArray(2, 0) = #2/10/2015#: UACFArray(2, 1) = #3/10/2015#
  UACFArray(3, 0) = #2/24/2015#: UACFArray(3, 1) = #3/24/2015#
  UACFArray(4, 0) = #3/17/2015#: UACFArray(4, 1) = #4/14/2015#
  UACFArray(5, 0) = #3/31/2015#: UACFArray(5, 1) = #4/28/2015#
  UACFArray(6, 0) = #4/21/2015#: UACFArray(6, 1) = #5/19/2015#
  UACFArray(7, 0) = #5/5/2015#: UACFArray(7, 1) = #6/2/2015#
  UACFArray(8, 0) = #5/26/2015#: UACFArray(8, 1) = #6/23/2015#
  
  For x = LBound(UACFArray, 1) To UBound(UACFArray, 1)
      If checkpoint = UACFArray(x, 0) Then
          Block = UACFArray(x, 0)
          For y = LBound(UACFArray, 2) To UBound(UACFArray, 2)
              Block = UACFArray(x, 0) &amp; " " &amp; "-" &amp; " " &amp; UACFArray(x, y)
          Next y
      ElseIf checkpoint &lt;&gt; UACFArray(x, 0) Then
          For y = LBound(UACFArray, 2) To UBound(UACFArray, 2)
              If checkpoint &gt; UACFArray(x, 0) And checkpoint &lt; UACFArray(x, y) Then
                  Block = UACFArray(x + 1, 0)
                  Block = Block &amp; " " &amp; "-" &amp; " " &amp; UACFArray(x + 1, y)
              End If
          Next y
      End If
  Next x
  
  Debug.Print "Block = "; Block
  
  End Sub
  </code></pre>
  
  <p>With this version everything worked correctly however I did not try and reset value of blockstart(as this needs to be readjusted each step) </p>