1

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

9
  • use Offset() function Commented Feb 6, 2017 at 9:58
  • @iDevlop, could you pls show a short example how in this case? Commented Feb 6, 2017 at 10:02
  • 1
    I can't give you an example because I don't understand what exactly you want to do. Looks like you want to copy 15 cells into A3:C3 Commented Feb 6, 2017 at 10:12
  • @Al_Iskander - can you put a screenshot of what you would like to achieve? Commented Feb 6, 2017 at 10:21
  • 1
    [] is short for Evaluate("") msdn.microsoft.com/en-us/library/office/ff193019.aspx Commented Feb 6, 2017 at 12:07

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

typing comment on a phone is a bit frustrating for me so I hoped you wouldn't mind :]
actually I am impressed by the people who can put value into SO through a phone! :) +50 :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.