.


:




:

































 

 

 

 


.

.

IF THEN

 

.

 

:

:

IF < > Then [ 1] [Else [ 2] ]

 

:

IF < > Then

[]

[ElseIf < n > Then

[-n ]

[Else]

[]]

End If

. TRUE FALSE.

1 2 . . (TRUE), 1, , 2.

:

:

IF A>10 Then A=A+1: B=B+A: C=C+B ELSE C=A*B: A=C+2

:

IF A>10 Then

A=A+1: B=B+A: C=C+B

ELSE

C=A*B: A=C+2

End If

 

 

EXCEL.

EXCEL. :

Worksheets() EXCEL

RANGE()

Cells(i,j) - (i , j )

.Value .

 

.., F , :

Worksheets(1).Range(A2).Value = F, EXCEL .

Worksheets(1).Cells(2,1).Value = F

 

 

Excel

 

F X

X/2, >=0

F=

(X+1)/2, <0

Excel .

 

Excel VBA 1.

1. . Range().

 

Sub Test_1 ()

X=Worksheets(1).Range(A2).Value

IF >= 0 Then

F=X/2

Worksheets(1).Range(B2).Value = F

Else

F=(X+1)/2

Worksheets(1).Range(C2).Value = F

End If

End Sub

2. . . . Cells().

Sub Test_2 ()

X=Worksheets(1). Cells(2,1).Value

IF >0 Then

F=X/2

Worksheets(2). Cells(2,2).Value = F

Else

F=(X+1)/2

Worksheets(2). Cells(3,2).Value = F

End If

End Sub


 

1

.

, Range Cells.

 

2

1. (x1, y1) (x2, y2). , , .

2. a, b, c.

3. x y , x , y .

4. A, B X, Y, Z . , .
5. , . , , .

2

 

2.1. (ForNext)

For.

For . :

 

For _ = To [ step ]

Next [ _ ]

 

_ . , .

- . =1.

. , , :

_>

, :

_<

, Next. , , Next, . ForNext Exit For. , .

:

:

:

Y=∑ Ln (X/2)n , n=1,2,,5

:

1:5 .

:

Sub Test_3 ()

n=5

Y=0

For i=1 to n

X=Worksheets(1).Cells(i,1)

Y=Y+log(x)/2^i

Next i

Worksheets(1).Range (A6).Value =

Worksheets(1).Range (A7).Value = Y

End Sub

 

.

a)

Dim < >(< > To < >) As < >

: Dim A(1 To 10) As Integer - 10 , - Integer.

)

: , .

: A(1)=5 - 5

(17)=(1) - 17- .

)

Excel, InputBox.

: ,, 15 :

For i=1 To 15

' A Excel, Range ( , 1 15.

A(i)=Worksheets(1).Range("A" & i).Value

' B Excel, Cells ( 1 15, 2 ( B)

B(i)=Worksheets(1).Cells(i,2)

' C InputBox

C(i)=InputBox(" " & i & " ")

Next i

)

1. 1:5 .

2. :

Sub mm ()

Dim A(1 to 5) As Integer

N=5

Y=0

For i=1 to n

A(i)=Worksheets(1).Cells(i,1)

Next i

For i=1 To n

Y=Y+log(A(i))/2^i

Next i

Worksheets(1).Range (A6).Value =

Worksheets(1).Range (A7).Value = Y

End Sub


3

.

:

1. 10 , . , InputBox Excel.

2. Excel.

3. , Excel MsgBox.

 

1. 2. .
3. 4. .  
5. .
6. .
7. , .
8. .
9. .
10. , .
11. , .
12. : [i]=x*sqrt(a[i]), .

 

)

Dim < >(< > To < >,

< > To < >) As < >

: Dim A(1 To 10, 1 to 5) As Integer - 50 (10 5), - Integer.

)

: , , .

: A(1,4)=15 - , 15

)

Excel, InputBox.

 

1) for i=1 to 10

for j=1 to 4

A(i,j)=InputBox(" A(" & i & "," & j & ")")

next j

next i

2) for i=1 to 10

for j=1 to 4

A(i,j)=Worksheets(1).Cells(i,j)

next j

next i

) -

 
 

 


4

.

:

1. 4´4, , . , InputBox Excel.

 

2. Excel.

 

3. :

- .

- .

- , .

 

:

.

3. ( ).

-



<== | ==>
| .
:


: 2017-02-11; !; : 370 |


:

:

, , . , .
==> ...

1714 - | 1549 -


© 2015-2024 lektsii.org - -

: 0.032 .