. , . , , .
. . . . , .
:
1) , ;
2) ;
3) ;
3) ( ) ;
4) .2, .
. , , . , , .
, , . . , , , , , . , , .
:
1) ... ( );
2) ( );
3) ( ).
. 1.
. 1. :
( ),
( ),
( )
VBA :
FOR... NEXT;
DO... LOOP;
For... Next
For...Next , , .
For...Next :
For = To [Step ]
[ ]
Next
, .
|
|
.
VBA 1 ( 1). For Step.
For...Next VBA :
;
, , Next, VBA , ;
( Step); Step , VBA 1;
. , VBA . ,VBA Next.
>0, , <0 . .
For...Next , . , . , . . , , . , .
. 4
Sub Demo_ForNext()
' , ,
Dim xStart, xEnd, xStep As Integer
Dim x As Integer
Dim i As Integer
Dim xradian, y As Single
' Excel
xStart = Cells(2, 2)
xEnd = Cells(3, 2)
xStep = Cells(4, 2)
'
i = 1
For x = xStart To xEnd Step xStep
' x
xradian = 3.14 * x / 180
'
y = (2.51 * Sin(xradian) / (2 + 3 * Cos(xradian)) ^ (1 / 3))
i = i + 1
'
Cells(i, 4) = x
Cells(i, 5) = y
Next x
End Sub
For...Next , , FOR, .