title: concurrency and multi-threading in excel vba
body: <p>So I searched online and most answers I got said that there is no concurrency in Excel. But some posts say that EXCEL 2007 offers multi-threading for faster calculations. I'm really confused, is it possible or not?</p>
  
  <p>In my workbook, there are some cells are calculated using user defined functions. These cells are updated through a RTD server once per second. So does this mean that these functions appear to be re-calculated paralleled, but in fact, Excel just schedules them sequentially? Does it make a difference if the computer has multiple cores or not? </p>
  
  <p>If, in fact, these functions are running sequentially, would the following two be equivalent? In terms of performance and speed.</p>
  
  <p>1) </p>
  
  <pre><code>cell1 = userFunc(1, switch1)
  cell2 = userFunc(2, switch2)
  cell3 = userFunc(2, switch3)
  </code></pre>
  
  <p>and 2)</p>
  
  <pre><code>cell = func()
  
  where func() is
  
  public function
          if(switch1)  call userfunc1
          if(switch2)  call userfunc2
          ....
  
  end function
  </code></pre>
  
  <p>And let's assume all the necessary adjustments to the functions are made. I mean, would the first one be faster? </p>
  
  <p>Thanks a lot!!!</p>
  
  <p>UPDATE: So if there's no real concurrency in VBA, does that mean functions are called sequentially and shared global variables can be accessed without locking problem? I have an API object that's used by virtually every function, so can I shared it instead of initialize it everytime I use it? This object is just an API used to call some static functions, there's no modification or anything to the object itself.</p>