title: Excel 2010 VBA Referencing Specific Cells in other worksheets
body: <p>I'm sorry this is probably an extremely basic <code>Excel VBA</code> question.  I've just started learning it, and I am not finding very much in the way of good tutorials.  I can't find much organised information on the language at all actually.</p>
  
  <p>I've got a couple worksheets called "Sheet1" and "Sheet2".<br>
  The first and second columns of Sheet1 contain some numbers.</p>
  
  <p>I want to write a macro which prints the results of a function taking 2 variables (one each from column A and column B) to Sheet2.  but I want to space these results out in the new work sheet so that the result of the function on Column 'i' in Sheet1 is put into row 1 and column 4*i.  Here's what I've tried to do so far, but it hasn't worked because I don't know how to reference specific cells in other worksheets properly.</p>
  
  <p>Apologies that this is a very newb question, any help is much appreciated!</p>
  
  <pre><code>Sub results()
  
      Dim i As Integer, noValues As Integer
      noValues = Application.CountA(Range("A:A"))
  
      Sheets("Sheet2").Select
      Range("A1").Select
      For i = 1 To noValues
          Range("A1").Offset(0, 4 * (i - 1)).Select
          ActiveCell.FormulaR1C1 = "=Sheet1!A[i] + Sheet1!B[i]"
      Next i
  
  End Sub
  </code></pre>
  
  <p>Where A[i] and B[i] should mean the value in Column A or B, row i.</p>