title: Simple VBA function that returns product of range value
body: <p>I want the function to take a range of cells as an argument and return their product. 
  Let's assume the following value for cells: </p>
  
  <pre><code>A1=5 
  A2=2 
  A3=3 
  </code></pre>
  
  <p>Let's call the function <code>Multiply</code>.
      <code>=Multiply(A1:A3)</code> will return 30 (=5×2×3).</p>
  
  <p>What is the code for this? I'm just trying to familiarize myself with the syntax and this will help out a lot. </p>
  
  <p>Edit: figured it out:</p>
  
  <pre><code>Function multiply(rng As Range)
  
      multiplied = 1
  
      For Each cell In rng
          multiplied = multiplied * cell.Value
      Next
  
      multiply = multiplied
  
  End Function
  </code></pre>