I'm sorry this is probably an extremely basic
Excel VBA 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.
I've got a couple worksheets called "Sheet1" and "Sheet2".
The first and second columns of Sheet1 contain some numbers.
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.
Apologies that this is a very newb question, any help is much appreciated!
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
Where A[i] and B[i] should mean the value in Column A or B, row i.