title: Applying equation to column
body: <p>I have a spreadsheet which has data under an x and y column. There's some y values that are missing and I need to make a script file that uses the x values and computes the missing y values using a linear equation.</p>
  
  <p>Also, there is parts in the y column that has data and then it is missing data and then there's data etc. Is there also a way to use the equation on all the cells in a range except the cells where there is already a y value.</p>
  
  <p>I can provide a sample workbook if needed. Any help would be greatly appreciated.</p>
  
  <p>Thanks,</p>
  
  <p>EDIT:
  I've posted a link of what I attempted. I'm a novice at Excel so it might not be the best attempt.</p>
  
  <pre><code>Sub LinearCorrelation()
      Dim Data As Integer
      Dim Result As Integer
      Data = ActiveSheet.Range("B2").Select
      Result = 2 * Data + 12.5
      Sheets("Sheet3").Range("D2").Value = Result
  End Sub
  </code></pre>
  
  <p>When I run the above script. I get -1 in the D2 which is wrong. The value for 'Data' is 10 so the answer should read 32.5.</p>