I have a matrix of 400 commandbuttons (20 by 20) on a Userform and wish to loop through them, not horizontally, but vertically viz. 1,21,31...391, 2, 22, 32...392 through 380,390,400. Since the For each ... Next construct sweeps horizontally, this popular loop fails. I have attempted, to no avail, to coerce Excel using conventional For..Next loop with 20 increments as in:
num=1
For n = 1 to 400 Step 20
Controls("CommandButton" & n).Caption = num
num = num +1
If n\400=4 Then n = (n-400)+1
Next
The above code is merely demonstrative as it only assign captions. The real object is to get a handle to do the vertical cosine-curve looping. Any ideas?
Thanks
David
Bookmarks