0

I am trying to apply 'For loop' in excel VBA and I have to go to cell numbers 2, 8, 15, 21, 28, 35, 49, 56, 63, 70, 76; as there is no fixed pattern/sequence,I am not able to use Step command, how should I go about it?

1
  • Welcome to Stackoverflow! Can you please elaborate your question having your effort like code or something so that people could get your problem early and help you? Thanks! Commented Apr 8, 2016 at 3:20

1 Answer 1

3

Use an array and loop through it.

dim vars as variant, v as long
vars = array(2, 8, 15, 21, 28, 35, 49, 56, 63, 70, 76)
for v = lbound(vars) to ubound(vars)
    'do something with cells(vars(v), <some column>) or cells(<some row>, vars(v))
next v
Sign up to request clarification or add additional context in comments.

Comments

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.