fbpx
Search
Close this search box.

CP039: May the FOR Loop be with you – Introduction to For Loops in Excel VBA

Share

Facebook
Twitter
LinkedIn

In the 39th session of Chandoo.org podcast, Let’s learn about FOR loops.

There is a special giveaway in this podcast. It is a workbook with several FOR loop VBA code examples. Listen to the episode for instructions.

Introduction to Excel VBA FOR Loops - What are they, how to use them - Chandoo.org Podcast - Session 039

What is in this session?

In this podcast,

  • Announcements
  • What is a loop – plain English & technical definitions
  • For Loop vs. other kind of loops (While & Until)
  • For Next loops
  • For Each loops
  • Nested For loops
  • Special tips on For loops
  • Performance issues & infinite loops
  • Conclusions & giveaway

Listen to this session

Click here to download the MP3 file.

Links & Resources mentioned in this podcast

Introduction to VBA

Using FOR Loops – Examples

Optimization & Performance of VBA code

Transcript of this session:

Download this podcast transcript [PDF]

Are FOR loops strong with your VBA code?

I personally favor FOR loops over While loops. I learned about loops in 1996 (in BASIC language). Any powerful application or program I have built ever since has its share of FOR loops. They are vital for doing awesome things with computers.

What about you? Do you use FOR loops often? When do you use them? What are your favorite implementations. Please share your tips & thoughts in the comments area.

Remember: Email me at chandoo.d@gmail.com once you finish the task mentioned in the podcast to get your FOR loops example workbook.
Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Excel School made me great at work.
5/5

– Brenda

Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

letter grades from test scores in Excel

How to convert test scores to letter grades in Excel?

We can use Excel’s LOOKUP function to quickly convert exam or test scores to letter grades like A+ or F. In this article, let me explain the process and necessary formulas. I will also share a technique to calculate letter grades from test scores using percentiles.

7 Responses to “CP039: May the FOR Loop be with you – Introduction to For Loops in Excel VBA”

  1. Mark says:

    I use FOR loops a lot when processing blocks of data in Excel. Sometimes it is laziness because using the FIND method to locate specific matches has effects on your application's default FIND behaviour unless you carefully restore all the default parameters like search type, direction, start point etc. after running code. A FOR loop can find data in 10,000-20,000 rows using If or Select Case within a few seconds, especially if search range is one column. In these cases the FOR condition is simply to execute from a start row number to an end number, which can be automated within VBA by locating the extent of the data using Range End properties.

  2. SOMNATH LAL says:

    IT IS REALLY VERY INTERACTIVE .

  3. V. SURESH says:

    I have used FOR LOOP a few times by borrowing/ copying and modifying the codes from other projects. STEP and EXIT FOR is new to me. Thank you for the information. The language is simple and easily understood. Thank you again and may GOD bless you good health with a bright future.

  4. Sanjay says:

    Owesom if u can share for loop

  5. Sebastian says:

    As always, the podcast is a fantastic resource for people with an interest in VBA yet not an extensive knowledge of it like me. Chandoo's clear commitment to the improvement of the skills of the listeners and his pedagogical talents are no longer a surprise but are still something I really appreciate.

    Just as for an earlier user, the use of STEP and EXIT FOR are new to me despite having used FOR loops before.

    Even for the casual user of VBA that somehow lands on this page, I fully recommend taking the type to list the podcast in its entirety as the payoff will make the time investment worth it.

  6. ashish says:

    Very Helpful. Whatever i have come across by now on this website is AWESOME. THANKS.

  7. Sandeep Kothari says:

    Great journey through FOR loops in VBA. Need to learn more of VBA from you.

Leave a Reply