Hiyall!
This is a followup to previous post. So here is the code which works.
Sub MarcoTemplate()
Dim c As Range
Dim n As String
For Each c In Sheets("ref").Range("A2:A3")
n = c
Vl = Application.WorksheetFunction.VLookup(n, Sheets("ref").Range("A2:D3"), 2, False)
Worksheets.Add.Name = c
ActiveSheet.Move After:=Sheets(ActiveWorkbook.Sheets.Count)
Worksheets("temp").Range("A1:D3").Copy ActiveSheet.Range("A1")
Range("C2").Select
ActiveCell.FormulaR1C1 = "=ref!R2C2" + "+1"
Selection.AutoFill Destination:=Range("C2:C3")
Range("D2").Select
ActiveCell.FormulaR1C1 = "=ref!R2C2" + "*4"
Selection.AutoFill Destination:=Range("D2:D3")
Range("G2").Select
ActiveCell.FormulaR1C1 = Vl
Next c
End Sub
However I'd like to know how do I add formula change within it? I need for each c move formula 1 column or row in any direction in ActiveCell.FormulaR1C1 = "=ref!R2C2" + "+1"
First thing I thought was to add new variable lets say "d" and assing value to it and add +1 in the end like "R2C"&"d" but I dont know how to make d+=1 in the end.
Also another question, how do I change ActiveSheet to the name of newly created list? Sheets("n") does not work.