title: How can I perform an operation in excel vba for an user-defined range?
body: <p>I have a series of cells with values i.e.</p>
  
  <p><a href="https://i.stack.imgur.com/Doj1K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Doj1K.png" alt="enter image description here"></a></p>
  
  <p>I would like to have a for loop that is doing the average of the first value in column A (1), the adjacent value in column B (3) and the adjacent value in column C (74). I would need the user to choose this range with a msgbox.</p>
  
  <p>So far I could code this, with the help from the macro recording:</p>
  
  <pre><code>Sub averager()
      Dim ran As Range, average As Variant, cell1 As Variant, cell2 As Variant
      Dim i As Variant
  
      Set ran = Application.InputBox(Prompt:="Enter range values: ", Type:=8)
  
      For i = 0 To i = 8
          ran.Offset(0, 13).Select
          ActiveCell.FormulaR1C1 = "=AVERAGE(RC[-13]:RC[-11])"
          average = WorksheetFunction.average(ran.Text)
      Next i
  End Sub
  </code></pre>
  
  <p>However, this code doesn't perform the loop and it returns only the first triplicate's average in the offset position I chose.</p>
  
  <p>How can the loop perform the operation for all the values?</p>