Reputation: 1001
I would like to dynamically apply below INDEX function for two ranges where one range should be dependent on an iterator i
.
Could anyone help how to write that down instead of my code example (only the Index part with the reference, please)?
With ActiveSheet
For i = 1 to 5
.Range("c" & i & ":I" & i & "") = [INDEX(EURbased!C5:I5 * EURbased!C4:I4,0)]
Next
End With
I would like to use iterator i instead of the "5"
in EURbased!C5:I5
Upvotes: 1
Views: 244
Reputation: 43595
Try it like this:
With ActiveSheet
For i = 1 to 5
.Range("c" & i & ":I" & i & "").formula = "=INDEX(EURbased!C" & i & ":I" & i & " * EURbased!C4:I4,0)"
Next
End With
I have not tried it myself, but as far as you mentioned I would like to use iterator i instead of the "5" in EURbased!C5:I5
I think it should work.
Upvotes: 1