, . : , . , Visual Basic.
, Visual Basic . , , , , .. , ( [Enter]), , (. 2‑4).
. 2‑4. , :
. (. 2‑5).
. 2‑5. , :
For (Next)
:
1. .xls 1 , 10 10 :
Sub ()
Dim As Integer
For i = 1 To 10
= Int (100 * Rnd())
Cells(i, 1).Value =
Next i
MsgBox " !"
End Sub
2. .
. :
,
, , ,
, , , ..
. 2 _:
Sub ()
Dim x As Double
Dim y As Double
x = CDbl (InputBox(" :"))
y = 1/x
MsgBox " :" & y
End Sub
( InputBox). , 0 . , VB , (. 2‑6):
. 2‑6. :
Debug (), , , . (. 2‑7).
(. 2‑2), .
. 2‑7. _
|
|
. .xls ( 2), .xls . , , 9 (. 2‑8). , [3].
. 2‑8. Workbooks(" .xls")
, .xls :
Sub ()
'1. :
Dim As String
Dim As Integer
'2. :
= Workbooks.Count
'3. .xls:
For i = 1 To
If Workbooks(i).Name = " .xls" Then
= Workbooks(i).Author
MsgBox " : " &
Exit Sub
End If
Next i
MsgBox " .xls !"
End Sub
:
1. 2 .
2. , .xls /.