title: How to pass a date as an argument in an Excel VBA function
body: <p>I'm trying to make a function that will take a date in a cell as an argument, then use that date to lookup a value.  The date to be passed will be in the variable EffDate.  Then the function should go to the worksheet RateChgs, check the NewPymtEffDateRange for the EffDate, and, upon finding it, go to the EscrowPymtAmtRange (one column wide) and return the value on the same row there.</p>
  
  <p>I've only gotten to the point of testing it in the immediate window by typing GetEscrowPymt(8/1/2000) (or some other date).  From the value of the Position variable, I can tell that the function isn't finding the date even though it's there.  Is this a problem with how I'm passing the date?  </p>
  
  <pre><code>Function GetEscrowPymt(EffDate As Date)
  Dim PymtEffDateRange As Range 
  Dim EscrowPymtAmtRange As Range 
  Dim Position As Integer 
  
  Set PymtEffDateRange = Worksheets("RateChgs").Range("NewPymtEffDate")
  Set EscrowPymtAmtRange = Worksheets("RateChgs").Range("EscrowPymt")
  
  Position = Application.WorksheetFunction.Match(EffDate, PymtEffDateRange, 1)
  MsgBox (Position)
  
  End Function
  </code></pre>