Okay, the first part selects the input for a sheet that I have made:
Sheets("Mean Needed Weekly").Select
Range("E2").FormulaR1C1 = "=Projections!R[2]C[-3]"
Range("E3").FormulaR1C1 = "=Projections!R[1]C[-2]"
Range("E4").FormulaR1C1 = "=Projections!R[0]C[-1]"
Range("E5").FormulaR1C1 = "=Projections!R[-1]C"
Range("E6").FormulaR1C1 = "=Projections!R[-2]C[1]"
Range("E7").FormulaR1C1 = "=Projections!R[-3]C[2]"
Range("E8").FormulaR1C1 = "=Projections!R[-4]C[3]"
Range("E9").FormulaR1C1 = "=Projections!R[-5]C[4]"
Range("E10").FormulaR1C1 = "=Projections!R[-6]C[5]"
Range("E11").FormulaR1C1 = "=Projections!R[-7]C[6]"
Range("E12").FormulaR1C1 = "=Projections!R[-8]C[7]"
Range("E13").FormulaR1C1 = "=Projections!R[-9]C[8]"
There is 11 input values taken from a row as you could see. When I change i I would like to change where I get the input to the row underneath (i.e row four instead of three when i=1). That's why I tried some ...Projections!R[-4]C[3]" to ...Projections!R[-4+i]C[3]" but as you told me, I have big problems with the syntax and the functions, I am a totally newbie in VBA.
This is not enough however. The for loop (i) also change where I paste the output from the sheet. The output is taken from the same place as before but pasted at another location.
Range((2), (i + 3)).Select ' This is wrong
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
The first time its at C2, but the next time (i=1) I would like to post it at column D.
This things that I do would perfectly fine with just one loop if it begins in the beginning of the macro.
Most of the code is taken by the record macro function. The problems start when I have to change it in order to insert a working for loop.
Best Regars
E
Bookmarks