(vba) loop concepts

montecarlo2012

Well-known Member
Joined
Jan 26, 2011
Messages
984
Office Version
  1. 2010
Platform
  1. Windows
Hello. what kind of reasoning I have to apply, to understand how from the simple loop code here:
Code:
  [SIZE=3][COLOR=#000000][FONT=Calibri]Sub looptest()<o:p></o:p>[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000000][FONT=Calibri]Dim i As Integer, j As Integer<o:p></o:p>[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000000][FONT=Calibri]  For i = 1 To 6<o:p></o:p>[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000000][FONT=Calibri]    For j = 1 To 6<o:p></o:p>[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000000][FONT=Calibri]Cells(i, j).Value = i * j<o:p></o:p>[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000000][FONT=Calibri]      Next j<o:p></o:p>[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000000][FONT=Calibri] Next i<o:p></o:p>[/FONT][/COLOR][/SIZE]
[SIZE=3][COLOR=#000000][FONT=Calibri]End Sub<o:p></o:p>[/FONT][/COLOR][/SIZE]
how to populate a row with something like this:
2/B3:G20
3/B4:G21
4/B5:G22
5/B6:G23
6/B7:G24
7/B8:G25

<tbody>
</tbody>
is an excel recipe, or there are a logic explanation.


<tbody>
</tbody>
 
Last edited:

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
in cells(1,1) (when i=1 and j=1) to get a 2 I+1 put this in AA1 ie cells(1,27)
to get a 3 I+2 put this in cells(1,28)
to get a 20 I+19 put this in cells(1,29)

then make cell AZ1 =concatenate(aa1,"/B",aa2,":g",aa3)

you now have 2/b3:g20 in AZ1
 
Upvote 0
Thanks oldbrewer. When you said in cells you mean in the code the line cells (I, j) chance for the information you provide?. like cells(I+1,27). I am right or wrong?.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top