Originally posted by QVeen72
Nested For Loop to populate matrix
Collapse
X
-
I'm impressed, I couldnt work this out myself, i ould get the result but couldnt see how to use 2 for loops. -
I believe Veena's code is still needlessly complex. Try this version...
[CODE=vb]Private Sub Command1_Click( )
Dim i As Integer, j As Integer, s As String
For i = 0 To 49 Step 5
For j = i To i + 4
s = s & " " & j
Next
s = s & vbNewLine
Next
MsgBox s
End Sub[/CODE]This is part of the beauty of nested loops, of course - the inner one can make use of the counter value of the outer one. It can also change the value, but that's another story.Comment
Comment