title: Using named cells in a VBA function
body: <p>I have a worksheet where I have defined names for certain cells. These cells will be used in the function and I am calling them using their names.</p>
  
  <p>However, I get 0 as a return of the function when I call it with Excel, as if the names were not linked or had a 0 value.</p>
  
  <p>Below is the code I wrote. "Sum_Len_1", "L_W_2" ans "L_W_1" are the names I gave to the source cells.</p>
  
  <pre><code>Function min_w(depth)
  
      If depth &lt; Sum_Len_1 Then
          min_w = L_W_1 * 0.868 * depth / 1000
      Else
          min_w = L_W_1 * 0.868 * Sum_Len_1 / 1000 + L_W_2 * 0.868 * (depth - Sum_Len_1) / 1000
      End If
  
  End Function
  </code></pre>
  
  <p>How can I solve the problem?</p>