.


:




:

































 

 

 

 


. 3




1 [ 2 [ ]]

. , , .

. VBA , . .

(), 7. 1 . ( ).

 

7 -

  , ()
 
  (^)
  - ( )
  (*) (/)
  (\)
  Mod ( )
  (+) (-)
  >, <, >=, <=, <>, =
  Not
  And
  Or

 

VBA . :

- ;

- , ;

- , , ;

- ;

- .

2.6.1

 

, . . , .

, . =.

:

_ =

_ ();

= ;

(), , ,

, .

.

, , , .

1.

x = 2

x = x + 2

( 4)

Set.

Set :

Set objectvar = [New] objectexpression [Nothing]

New , ;

Nothing , , (.. ).

2.

Dim A as Object

Set A = cmdOK

MsgBox .Caption

Set cmdOK .

 

2.6.2

 

.

, , , . VBA 8.

, , .

. .

 

8 -

[1] + [ 2]
[ 1] [ 2]
-[ 1]
[ 1] * [ 2]
[ 1] / [ 2]
[ 1] \ [ 2]
[ 1] mod [ 2]
[ 1] ^ [ 2]

 

Rezult = 10\3 3 ( );

Rezult = 10 mod 3 1 ( );

Rezult = 9 ^ 0.5 34

Rezult = 2 ^ -2 0.25

:

:

Rezult = 1 2 N

Rezult , ;

1, 2, , N , , , .

 

2.6.3

 

, , True () False (), Boolean . VBA 9.

 

 

9 - VBA

1 > 2 . - True,
1 >= 2 . - True,
1 < 2 . - True,
1 <= 2 . - True,
1 <> 2 . - True,
1 = 2 . - True,

 

, True () False (). 10.

 

10 -

25 <> 30 True (25 30)
25 < 30 True (25 30)
25 > 30 False (25 30)
TextBox1.Text = True, , - False
Number >= 100 True, Number 100, False

 

2.6.4

 

. , . VBA 11.

 

11 - VBA

(1) AND ( 2) . True , True
( 1) OR ( 2) . True , True

11

Not [] True, False. False, True
[1] Xor [2] True, True. , False

 

2.6.5

 

VBA . . (&). . , .

:

str_1 & str_2 [ & str_N]

str , ( , ).

& - , . . .

1.

strMy = Visual & Basic for Applications

. . Visual Basic for Applications).

 

2.7

 

VBA, , . : , .

. , . , .

, . , , , ..

, .. . .

VBA , .

, , . ( ), , . . Debug ().

Debug. , View () Toolbars ( ) Debug.

Debug :

Run Sub/UserForm /

Break

Reset

Toggle Breakpoint /

Step Into

Step Over

Step Out

Locals Window /

Immediate Window

Watch Window /

Quick Watch

Call Stack .

12 13, Debug Debug.

 

 

12 Debug

 

 

13 Debug

2.7.1

 

, , , 14, , . Run Sub/UserForm, , , , , 15.

 

 

14

 

 

15 Run Sub/UserForm

 

; . , , .

.

1 , , Run continue . , , .

2 , , Debug Set Next Statement F5. , .

3 , Run Reset.

 

2.7.2 ( )

 

. , . .

1 , , F9.

2 Debug, Toggle Breakpoint ( ).

, , . , , 16. , , , , F5.

, , F5. Debug Clear All Breakpoints ( ).

, . (watches).

 

 

16 ,

2.7.3

 

.

1 , ( F9).

2 , F5 Run Sub/UserForm.

3 , . , 17.

 

 

17

 

. Watches ( ). .

1 , , 18. F5 .

2 , .

 

 

18 Watches

 

3 19 Add Watch ( ).

4 Add Watch : (Expression), (Context), (Watch Type). <OK>, 20.

 

 

19

 

 

20

 

5 Watches, 21, View Watch Window ( ).

 

 

21 Watches

 

2.7.4

 

. : Step Into ( ) Step Over ( ). , . , .

Debug .

1 .

2 View ToolBars ( ) .

3 Code, .

4 <Step Into> ( ) Debug . . .

5 Sub, . , , Watches (). , .

6 , <Quick Watch> ( ) Debug. , , , .

7 Add. Watches, . , .

8 <Step Into> ..

, , Watches, , .. .

 

2.7.5

 

VBA . 12 .

 

12 - VBA

 
 
 
 
 
 
  ,
 
 
 
 
  /
 
 
 
 

12

 
  .
 

1

: -, . 1 13, 14 (2 ).

 

13

,
  ; =0.83, =1.2
  ; =0.12, =0.36
  ; a=0.394, b=0.124, x=0.842
  ; a=0.124, b=1.14, x=2.125
  ; a=0.343, x=0.834
  ; a=0.334, x=1.256

13

  ; x=0.104, a=4.213
  ; x=0.117, a=2.346
  ; b=0.2, x=0.114
  ; x=2.512, a=0.135
  ; x=2.126, b=2.438, a=0.324
  ; x=0.834, b=0.242, a=0.125
  ; a=0.344, x=0.125
  ; a=2.124, b=0.835, a=0.54
  ; a=0.344, b=1.124, x=0.455

 

13

  ; x=0.345, a=1.242
  ; x=0.117, a=0.832
  ; a=0.124, b=0.338, x=0.817
  ; a=0.274, b=0.392, x=0.736
  ; b=0.614, a=0.125, x=1.23

 

14

  , =((..-..)/..)*100
  : Y=(D/P)*100 Y - ; D - ; P - .

 

14

  (SFP), : SFP=UZP/(SP+A+M). SP - ; - .. , ; UZP - - ; M - .
  S=VP/360*(D1-D2) VP - ; D1- ; D2- .
  1 5 : Vp=Vt/(1+r)t; r=d/k*100% Vp - ; Vt - ; r - ; t - ; k - ; d - .
  : ( na=20%)-a=1340000 ; ( nb=10%)-b=460000 ; ( nc=16.67%) c=200000 ; ( nd=9.09%)-d=100000 . ch=(na*a+nb*b+nc*c+nd*d)/(a+b+c+d)*100
  , : , . =/* - ; - ; - ; - .

 

 

14

  200 .. 10% . , , , (m) 12, (ch) - 20000000 ., 10. : apr=2*mch/(p*(n+1)).
  (p) : P = c-(a+z1+z2)/b c - ; a - ; z1 - ; z2 - ; b - ; 100000.
  , : K=(S1-S2)/(K1-K2) S1 S2 - ; K1 K2 - .
  , : =t+z+u+s - ; - ; s - ; z - .
  PV = P/EXP(N*LN(1+R)) - ; R - .
  : M=MS*B*P/100(/) - ; B - ,%; P - ; MS - : MS=R*H/1000, R- ; H- , .

14





:


: 2016-10-07; !; : 410 |


:

:

: , .
==> ...

1494 - | 1468 -


© 2015-2024 lektsii.org - -

: 0.079 .