Thread: Loop
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Loop

Look in the help at For Next loops.
There is an outer loop (r counter), looping through rows and an
inner loop (c counter), looping through columns.
You could add a Msgbox before the cells line:
Msgbox "now doing row " & r & vbcrlf & "column " & c
to make it clearer what is going on.
A basic book about VB(A) would help.

RBS


"Neil" wrote in message
...
Thanks RB & Joel!

I'm trying to understand how this loop works..could you explain
please?

thanks again!

Neil
On Jan 15, 9:09 am, "RB Smissaert"
wrote:
Sub FillUp(lMax As Long)

Dim r As Long
Dim c As Long

For r = 1 To lMax
For c = 1 To r
Cells(r, c) = Chr(96 + c)
Next c
Next r

End Sub

Sub test()

FillUp 6

End Sub

RBS

"Neil" wrote in message

...



Hi,


Is there some way to put a number sequence in the following pattern
into a sheet..
A B C D E F
Row 1 a
Row 2 a b
Row 3 a b c
Row 4 a b c d
Row 5 a b c d e
Row 6 a b c d e f


Thanks


Neil- Hide quoted text -


- Show quoted text -