Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » For and Next loops
For and Next loops
Resolved · Low Priority · Version 2007
Tracey has attended:
Excel Advanced course
Excel VBA Intro Intermediate course
For and Next loops
Hi
We have done a lot of For and Next loops where the looping variable is a series of numbers, eg:
For intName = 1 to 10
Can you set up this looping with non-sequential numbers, or with text? Or can you refer to a list in another location?
eg For dateMonth=Jan,Feb,Mar etc
eg For strName=each of the values on rows 2 to 8 in column 3 on the sheet "List page"?
Thanks
Tracey
For upcoming training course dates see: Pricing & availability
RE: For and Next loops
Hi Tracey,
Thank you for your question.
Here is a line of code that will allow non sequential numbers:
For I = 0 to 100 step 2 - step 2 meaning every other number
On the advanced course we cover this and we also cover arrays which may help you.
I hope this has answered your question.
Regards,
Simon
Tue 23 Jun 2009: Automatically marked as resolved.
|
