title: How can I create a VBA function that will select values from excel and be "drag-able" (i.e. Will have different Inputs based on Active Cell)
body: <p>I am currently trying to create a macro that will crunch out a calculation based on values that are input into a row of excel. I want the function to be able to be repeated with a different row of excel inputs if i drag it down. I am new to programming in VBA and a newbie in programming as a whole so bear with me. The issue I am having it that if i select these inputs and assign them a variable like so:</p>
  
  <pre><code>Public Function LC() As Variant
  
      Dim hw As Double
      hw  = Range("D29").Value
      LC = hw
  
  End Function
  </code></pre>
  
  <p>The Value of "hw" will not change from say D29 to D30 if i move the function down a cell. I know the code above is incorrect for what i am trying to do but i don't know what way the code should be for this case. I have tried other codes based on simple google research but have not had any luck.</p>
  
  <p>Any help would be extremely appreciated so thank you in advance.</p>