Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

vba

ResolvedVersion 2003

Trevor has attended:
Excel Advanced course
Excel VBA Intro Intermediate course
Access Intermediate course
Excel VBA Advanced course

VBA

What is a nested loop?

RE: VBA

Hi Trevor

Thank you for the question. A nested loop is when one loop contains another loop. The example below has a loop for the columns and a loop to do each row in each column.


Sub Square100()
Dim iRowNum As Integer
Dim iColNum As Integer

For iColNum = 0 To 9
For iRowNum = 1 To 10
ActiveCell.Offset(iRowNum, iColNum).Value = iColNum * 10 + iRowNum
Next iRowNum
Next iColNum


End Sub


I hope that explains enough.

Laura GB

 

Training courses

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Adding a comment to a formula

1. At the end of the formula, add a + (plus) sign.
2. Type the letter N, and in parentheses, type your comment in quotation marks.

eg.

=CurrentAssets / CurrentLiabilities+ N("The formula returns Current Ratio")

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.15 secs.