title: How to call VBA function from Excel cells (2010)?
body: <p>I defined a few functions in a workbook using VBA, and then expected to be able to use them in a cell formula - but Excel does not recognise the function. I just get #NAME?</p>
  
  <p>Tried:</p>
  
  <ul>
  <li>Realising I had created an XSLX file, I converted it to a XSLM file. Didn't work.</li>
  <li>Removed all types from the function declaration. Didn't work.</li>
  <li>Moved the function into the worksheet VBA module. Didn't work.</li>
  <li>Added Public to the declaration. Didn't work.</li>
  </ul>
  
  <p>What am I missing?</p>
  
  <p>This isn't clever code, either:</p>
  
  <pre><code>Function Square2(AnyNumber)
  
  'return the square of any integer
  Square2 = AnyNumber * AnyNumber
  
  End Function
  </code></pre>