title: Why do I get a Compile error Argument not optional when all arguments are specified and non-null?
body: <p>I have a project that looks something like this:</p>
  
  <pre><code>Function boi(sheet As Worksheet) As Scripting.Dictionary
  Set my = New Scripting.Dictionary
  'actually some stuff with the sheet
  my.Add Key:="Foo", Item:="Bar"
  
  boi = my
  End Function
  
  
  Sub test()
  Dim tsheet As Worksheet
  Set tsheet = Sheets("INPUT_OLD_DATA")
  MsgBox (boi(tsheet)("Foo"))
  </code></pre>
  
  <p>When I try to run test(), it gives me a Compile error Argument not optional on the line <code>boi = my</code>. What I dont understand ist how there can be an Argument not optional error on a line where <em>no function is called</em>. As it doesn't actually get to the line <code>boi = my</code> I also don't think the error can be due to an invalid return.</p>
  
  <p>I come from Python/Javascript/Java, please pardon me if this is an extremely noob question. :)</p>