title: Excel VBA Cell Values showing up as intergers
body: <p>I'm working on a program with Excel's VBA functionality, but ran into a very strange logic error. </p>
  
  <pre><code>For SheetIndex = 1 To 6
      With ActiveSheet
      For ColIndex = 2 To 6
          For DateIndex = 0 To MinLimit
  
          datethingy = .Cells(1, ColIndex).Value
  
          If (.Cells(1, ColIndex).Value = Date_Array(DateIndex, 1)) Then
  
              For RowIndex = 2 To 11
  
  '           Compare every time slot value here to every time slot value in the array
              datethingy = Trim(CStr(.Cells(RowIndex, 1).Value)) 'ERROR OCCURS HERE
  
              If (Trim(CStr(.Cells(RowIndex, 1).Value)) = Date_Array(DateIndex, 2)) Then
                  .Cells(RowIndex, ColIndex).Value = "Checked"
              End If
  
              Next
          End If
          Next
      Next
      End With
  
      SheetIndex = SheetIndex + 1
      Application.Worksheets(SheetIndex).Activate
  Next
  </code></pre>
  
  <p>So in the code above, I go through a series of cell values and make comparisons to values I already have in my array. However, when I draw the values from the cells, rather than "8:30", it comes up as "0.354166666...7". I have no idea why it's coming up like this, I'm even making sure it's being compared as a string and not as an int or anything else. </p>
  
  <p>Here is where I set the values for the sheet's cells. </p>
  
  <pre><code>.Cells(2, 1).Value = "8:30"
  .Cells(3, 1).Value = "9:00"
  .Cells(4, 1).Value = "10:15"
  .Cells(5, 1).Value = "11:30"
  .Cells(6, 1).Value = "12:30"
  .Cells(7, 1).Value = "13:30"
  .Cells(8, 1).Value = "14:45"
  .Cells(9, 1).Value = "16:00"
  .Cells(10, 1).Value = "17:15"
  .Cells(11, 1).Value = "18:15"
  
  With Range("A2", "A11")
      .HorizontalAlignment = xlCenter
      .Font.Bold = True
      .ColumnWidth = 15
  End With
  
  ActiveSheet.Cells.Rows.AutoFit
  </code></pre>
  
  <p>Does anyone have any idea why this could be happening? </p>