,,,
1.
1.1
1.2
1.3
1.4
1.5
1.6
2
2.1 Excel
2.2 Visual Basic for Application
3
3.1
3.2
4
4.1
1.
, , , . , . . , .
, . , , . , , , , . (), . () . , () . , . , .
, , . . ( ), .
, , . . , . . . . . , .. , , . . , .
, , , . ().
1. . , .
2. . , . , , , .
, , . , .
3. . . , .. , , , . :
- ( ) ; .. - , , , , , ;
- , , , , ;
- , .
4. , . . -, . -, , .
: . .
, - , -. , . , , . . ( ).
, , . . , , .
5. , . , , . . ( ).
6. , . : , , , ; ( ), (, , , ); , ( , , , , ).
7. . .
<A, S, >, ( ); S ( ); . . [0, 0) [t0; T0), T0<∞. tÎ t = (A1t, A2t, ..., Akt)ÎA , , S StÌS, , t. , , .
, , . . , , . , , , .
.
() , . , . . . ( ) , , . . , .
. . , , , . .
, . . , . , (, , . .), .
. ( ) , , . , , . , , () , . . .
, : , , , . . , , . , . . , .
, CC (, , , ), . , , . , , .
. ( ). ( ), .
, : (, , ); ; () . , . , , . , . , , , .
. , , :
- , , ;
- , , , .
- , ;
- , , () .
- , ;
- , .
, .
, (, , -, ..). : , ; , , , , , , , ..
() , , , . : , ; ; (). , , .
(), , .
, .
. . - , , , . , .
. : , - , . . , .
. . , , ..
. . , . . . .
. , , . , . .
. .
. . , , . . , . - , .
1.
. , , . . , . , . , . , , , .
2.
, . , . , . . . . , , ; ; . ; , ; . . , . : , , , ; ; . . , .
3.
: , , . (, , , , , .). : , , , .
4.
. -, . , , . -, . . , , .
, .
- , . , , -67, -2 ., - , , .
. , , , . ( , , ).
. , , , , . . - .
, . . , , - . , .
:
- ;
- - ;
- ;
- ;
- .
, , . , . , .
, , .
5.
:
1) ();
2) ().
("" ). . , , . . , , . , , , .., .
6.
: , , , , , .. , . . . , , . . , , .
7.
, , , ( ) .
, . . , . . , .
8.
. , . , , . . . . . OLAP (On-Line Analytical Processing), , , .
, .
Ki zi (, , ). Ki eij. tij zi Ki. Ki ti. ti , tij. aij ti, ti tij, eij. (aij, tij) aij.
K1, e1j t1 a1j (.1).
1.1 .
, , , t0 , . .
t0 = 0 S0 . Ki zi ti0 ei0. ti = tim m, ti,m-1≤t0<tim. T0=min{ti}, i0=argT0 ( i0 ). T0 , . , S1. (t0=T0) , .. (ti0=ti0+τi00). T1 , (t0=T1) .. (. . 2)
T0, T1, T2, ... / . , , . ( ).
, . eij , . , .. . , () .
. . . . .
, , . , . .
1.2 .
2
MS Excel Visual Basic for Application.
Microsoft Excel - , . Excel - , , , , , .
, ( ), .
Excel, :
;
;
;
, ;
, , ..;
.
(), Excel, ( ). , , . , . Excel 255 , 256 16 384 , .
, . 1 65 536, A IV ( Z, Z, Z IV). 1, 2, 255 , 31 .
Window (), , .
Excel . :
- Sheet () ;
- Chart () , .
. , , .
, , . Excel , . , , 1, , , IV65536.
, ! . 4 :
;
;
;
.
. , D14. , . , . .
, . , , . , 255 . . , . , , , .
Excel , . , . , , , .
, , .
Excel , . : 0,1,2,3,4,5,6,7,8,9 , : +, -, (, ), ,, ., %, ., *, /, , , Excel . , Excel , , . , , . .
Excel . , , . Excel 15 . .
, .
. , . Excel , .
, =, Excel . , .
, <Backspace> <Esc>, <F2>. <Backspace>, , <Esc>, .
, , <F2>. , . .
. - , /. /.
Excel . , . .
. , ( ) . . , .
Excel .
- , =. , , , . , , , . , , , , .
, . . , , . , , - .
3 :
, .
.
() , .
, , . , , . , , .
, .. .
.
. .
, . $ . .
Excel , . , .
.
(, , , , ) .
(, 2:12) Excel .
.
:
=[]!.
, . , .
, . Þ . , , . . .
Excel , (#). , . ( ), . (#), , , . , .
. Excel . , . , . , , , .
Excel , . . , , , [11].
. , . Excel .
Excel , . Excel, . Excel , Drawing ().
# / 0! |
1) 0. 2) |
#? | , Excel . , , , - |
#/ | . ( ) , , |
#! | ; , , . |
#! | ; , , . |
#! | . |
. 1.4.4.1. Excel
, , . , , , . , .
VBA Microsoft Office 2003. VBA Visual Basic 2003 . , VBA.
-, VBA , - , (), ( VBA) . , , Excel , VBA .
-, VBA, , .
, Excel Microsoft Office. VBA , [12].
Excel . , VBA. , Excel , .
: Excel , Visual Basic.
, . , . VBA-.
, , , , , , , [10].
:
- ;
- ;
- ;
- .
VBA- Visual Basic for Applications, , (VBA - ), ().
VBA Sub. ( , , ) . , . , . , , . . VBA .
Visual Basic
Visual Basic - , Office 2003. , , , , .
Visual Basic for Applications.
VBA - , , . , , , , . , , , , , . , . . , TextBox, . , , Employees roducts, - .
. , , , . , , , , ( , , , . .) [12].
- . Excel VBA- , , , . Excel. , , , , , . , .
, , , . , . , Name. VBA , , , .
, , ( , ) ( , ). , Excel . , , , . , , , , . VBA , , ( ), . , Sheetl Accounts ():
SheetI.Name- "Accounts"
Name . .
, . , . ; , . , Protect Sheetl , :
Sheetl.Protect
, , . , . , NewSheet, , ; SelectionChange . Excel ; , .
,
, - Worksheet Worksheet. (, Name, 1 R1C1), . , Printout Save, , SheetCaleulate , , Open.
,
, . :
Workbooks{"Bookl").ActlveSheet.Name= "Expenses"
Workbooks("Bookl").ActiveSheet Worksheet, , Bookl. Name Worksheet, ActiveSheet. Sheetl , :
Sheetl.Name= "Expenses"
, , Sheetl , .
ActiveCel1 Range , . Application ( , Excel) Window ( ) , , . :
Application.ActlveWlndow.ActiveCell.Borders.Color = vbRed
, ActlveCell Application Window . , - :
ActiveWindow.ActiveCell. Borders. Color = vbRed
:
Application.ActiveCell.Borders.Color = vbRed
, Range , :
ActiveCell.Borders.Color vbRed
Borders , . ActlveCellBorders Border ( ), Color () red (). vb, red, , Visual Basic, , .
, ActiveCell, - Range. , Borders , Range.
Application.ActiveWIndow.ActiveCell.Borders.Color = vbRed
, : , , [10].
Excel VBA
Range , , . , ActiveCell.Borders.Color = vbRed Cells () Format () Color () Border () Format Cells ( ).
, Range, Range. , . , : 1:
Range(Al")
Range("$ASl")
Range Range, , , . Range Range, 1 ( Value 1):
Range('Al"). Value
2 , , Calculate Range, Range:
Range("A2").Calculate
, Range, , . , :
Range("A3:B5.C3:D8").Value = 0
Range , , , . 1:4:
Workbooks("Bookl").Sheets("Sheetl") Range{'Al","C4"}.Select
VBA
VBA . , , . ( , , , ), . 1.1 [12].
1.1 VBA
, , . : (Declaration) . , , , , . , . Office 2003 , VBA. ( ), Sub End Sub. :
[Private | Public | Friend] [Static] Sub _ (_1, _2. ..._n)
< VBA>
< VBA>
< VBA>
End Sub
, :
[Private | Public | Friend] [Static] Function _ (_1, __2, ...
_n As __
< VBA>
< VBA>
- _
End Function
Private - , . , . Public, , . Friend , , . , Public. Static, ( , ).
. () . 11 , , .
VBA , . . . VBA , . [8].
VBA, , . , , . 11 , VBA ( ) Excel.
, VBA . . , , . Excel 2003, Visual Basic. , , : _._. , : _. _. _.
VBA
VBA . , . VBA . D1 , , . (VBA : !, #, $, %, &, @), , . 255 ( ) , ( @). VBA .
VBA
, . . , (If...Else, If...Then...Else, If...Then...ElseIf...Else Select Case).
, , - .
If...Then
If...Then VBA : If , ( ); , , . , . If...Then :
If Then []
, VBA , ; . If...Then, ( If), :
If Then
[]
End If
, VBA, -, , , End If.
If...Then...Else
If ...Then , . , , If...Then...Else. , , , .
, If...Then...Else , .
:
If Then
_1.
Else
_2
End If
, VBA onepa_1, , Else, _2 [12].
Select Case
Elself Select Case, .
Select Case , , , , - . ( ) .
Select Case , If ...Then, , . , : , . Select Case :
Select Case _
Case _1
_1
[Case _2
_2]
[Case Else
]
End Select
, . Select Case , End Select . , Case , _1, _2 . . - , VBA . , , . , . , _1. , , Case _1. , _2, , , , Case _2. Case. Case Else Else If. , , , , .
3
, , . . , .. . , . ( 2.1).
2.1
:
.
1 .
: , , ( ).
2 .
() ().
i- .
:
- - ();
- - () i- ();
- - ();
- - i- ().
3 .
, () ().
: .
4 .
i- .
5 .
, , , .
6 .
() () () [1].
1 :
' . , .
i = 2
While Cells(i, 1).Value > 0
i = i + 1
Wend
Cells(i, 1).Value = ModelTime
lsum = lsum + (ModelTime - tlprev) * l
l = l + 1
tlprev = ModelTime
2
' .
tActions(0) = tActions(0) + RndN1(k, min, max, v)
If tActions(0) > tRun Then
tActions(0) = TBIG
End If
i = 2
While Worksheets("Elements").Cells(i, 2).Value > ""
i = i + 1
Wend
Sheets("Elements").Select
det = RndP(Rp)
If det = 1 Then
Cells(i, 2) = 1
Else
Cells(i, 2) = 2
End If
1
' , .. 1 Elements
last = Range("A30000").End(xlUp).Row
tinmin = TBIG
For i = 2 To last
If (Cells(i, 3).Value = "") And (Cells(i, 1).Value > 0) And (Cells(i,1).Value < tinmin) Then
inmin = Cells(i, 1).Value
imin = i
End If
Next i
lsum = lsum + (ModelTime - tlprev) * l
l = l - 1
tlprev = ModelTime
2 젠
' 1, ..
'
state = 1
tkprev = ModelTime
tActions(1) = ModelTime
Cells(imin, 3) = tActions(1)
If Cells(imin, 2) = 1 Then
tActions(2) = tActions(1) + Tdown
Else
tActions(3) = tActions(1) + Tup
End If
' ,
' 1
If (tActions(2) <= ModelTime) And (Cells(imin, 2) = 1) And (state = 1) Then
ksum = ksum + (ModelTime - tkprev)
tkprev = ModelTime
l1 = l1 + 1 ' 1
Cells(imin, 4) = tActions(2) '
tActions(1) = tActions(2) + Tdown '
tActions(2) = TBIG
End If
' 1
If (tActions(3) <= ModelTime) And (Cells(imin, 2) = 2) And (state = 1) Then
ksum = ksum + (ModelTime - tkprev)
tkprev = ModelTime
l2 = l2 + 1 ' 1
Cells(imin, 4) = tActions(3) '
tActions(1) = tActions(3) + Tup '
tActions(3) = TBIG
End If
' 0, ..
If (state = 1) And (tActions(1) <= ModelTime) Then
state = 0
tActions(1) = TBIG
End If
'
If (state1 = 0 And l1 > 0) Then
' , .. 4 Elements
last = Range("D30000").End(xlUp).Row
tinmin = TBIG
For i = 2 To last
If (Cells(i, 5).Value = "") And (Cells(i, 2) = 1) And
(Cells(i, 1).Value > 0) And (Cells(i, 1).Value < tinmin) Then
tinmin = Cells(i, 1).Value
imin1 = i
End If
Next i
i1 = 1
state1 = 1 '
l1 = l1 1 ' 1
If ModelTime > Cells(imin1, 4) Then
tActions(4) = ModelTime
Else
tActions(4) = Cells(imin1, 4)
End If
Cells(imin1, 5) = tActions(4)
tActions(6) = tActions(4) + one '
End If
If (state2 = 0 And l2 > 0) Then
' , .. 4 Elements
last = Range("D30000").End(xlUp).Row
tinmin = TBIG
For i = 2 To last
If (Cells(i, 5).Value = "") And (Cells(i, 2) = 2) And
(Cells(i, 1).Value > 0) And (Cells(i, 1).Value < tinmin) Then
tinmin = Cells(i, 1).Value
imin2 = i
End If
Next i
i2 = 0
state2 = 1
l2 = l2 - 1
If ModelTime > Cells(imin2, 4) Then
tActions(5) = ModelTime
Else
tActions(5) = Cells(imin2, 4)
End If
Cells(imin2, 5) = tActions(5)
tActions(7) = tActions(5) + two
End If
'
If (tActions(6) <= ModelTime) Then
NextModelTime = False
'
Nb = Nb + 1
tbuysum = tbuysum + (ModelTime - Cells(imin1, 1).Value)
If i1 = 1 Then
state1 = 0
End If
Cells(imin1, 6) = tActions(6)
tActions(6) = TBIG
End If
'
If (tActions(7) <= ModelTime) Then
NextModelTime = False
'
Nb = Nb + 1
tbuysum = tbuysum + (ModelTime - Cells(imin2, 1).Value)
If i2 = 0 Then
state2 = 0
End If
Cells(imin2, 6) = tActions(7)
tActions(7) = TBIG
Call Trace("Finish", imin2)
End If
4
. Arrival, Begin, Processing, Finish . . k, min, max, v(i), i=. . 4.1 , , , .
4.1 - Trace
Copyright (c) 2025 Stud-Baza.ru , , , .