title: Excel (2010) VBA: Take in a date as a variable and store it
body: <p>Sounds simple enough: just store a date in a variable that is taken from a cell. That's all I really need. But I keep getting a 'Object required' error.</p>
  
  <p>I have a variable called cell, and the information I need is offset two and three columns to the left (so -2 and -3 using offset). I have tried using a string variable and converting it with CDate(), I have tried using an integer and storing it there, I tried datevalue. I am at a loss. Here is the latest revision of my code...</p>
  
  <pre><code>Function daysBetween(percent, quarters, cell As Range) As Boolean
  'this function returns true if the date is past the allotted time for the group
  
  cell.Select
  Dim target As String
  Dim issue As String
  Dim targetCell As Range
  Dim issueCell As Range
  Set targetCell = ActiveCell.Value
  Set targetCell = targetCell.Offset(0, -2)
  Set issueCell = ActiveCell.Value
  Set issueCell = issueCell.Offset(0, -3)
  Set issue = DateValue(issueCell).Value
  Set target = DateValue(targerCell).Value
  If ((target - issue - (Date - target)) / (target - issue)) &gt; (percent * quarters) Then
      daysBetween = True
  End If
  End Function
  </code></pre>
  
  <p>Thank you, I'm sorry about how messy it is... I am teaching myself VBA, I don't know what I'm doing 75% of the time :)</p>