98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum 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
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.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Go to source of a cellThe default setting in Excel is when you double click in a cell it actives the formula in the cell. If you have created a link and want to directly go to that link (say if on another sheet, click on Tools -options and take off the tick for eidt it directly in cell |