1
UserForm (Insert UserForm). Visual Basic :
(Toolbox).
:
2
(Properties), (Toolbox), , 4.2.
. Caption , - , .
3
, . UserForm1, :
Private Sub CommandButton1_Click()
TextBox1.Text=" --"
End Sub
UserForm1 :
Private Sub CommandButton2_Click()
TextBox1.Text=" --"
EndSub
Private Sub CommandButton3_Click()
TextBox1.Text=" --"
End Sub
4
, , . , , /User form (Run) . . --, .4.3.
, .
Microsoft Excel
4.1.
, , : , , , , , .
: Times New Roman, 14 , (Bold), (ColorIndex). : Arial Cyr, 10 , (Italic), (ColorIndex). .
.
Sub People()
Worksheets(1).Name = "" '
Worksheets(1).Select '
Cells(1, 1).Select '
ActiveCell.Font.Size = 14 '
ActiveCell.Font.ColorIndex = 3 '
ActiveCell.Value = " " ' " "
Columns("a:a").ColumnWidth = 40 ' 40
|
|
End Sub
4.2.
, . 1.
- ,
.
, ..
, , .
: , , , . .
- .
1. Private Sub CommandButton1_Click()
2. Dim i As Integer
3. Dim n As Integer
4. Dim As Double
5. Dim As Double
6. Dim As Double
7. Dim As Double
8. If OptionButton1.Value = True Then
9. = 0
10. With ListBox1
11. For i = 0 To.ListCount - 1
12. If.Selected(i) = True Then
13. = +.List(i)
14. End If
15. Next i
16. End With
17. =
18. End If
19. If OptionButton2.Value = True Then
20. = 1
21. With ListBox1
22. For i = 0 To.ListCount - 1
23. If.Selected(i) = True Then
24. = *.List(i)
25. End If
26. Next i
27. End With
28. =
29. End If
30. If OptionButton3.Value = True Then
31. = 0
32. n = 0
33. With ListBox1
34. For i = 0 To.ListCount - 1
35. If.Selected(i) = True Then
36. n = n + 1
37. = +.List(i)
38. End If
39. Next i
40. End With
41. = / n
42. End If
43. TextBox1.Text = CStr(Format(, "Fixed"))
44. End Sub
45.
46. Private Sub CommandButton2_Click()
47. UserForm1.Hide
48. End Sub
49.
50. Private Sub Frame1_Click()
51.
52. End Sub
53.
54. Private Sub ListBox1_Click()
55.
56. End Sub
57.
58. Private Sub UserForm_Initialize()
59. With ListBox1
60..List = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
61..ListIndex = 0
62..MultiSelect = fmMultiSelectMulti
63. End With
64. TextBox1.Enabled = False
65. End Sub
66.
67. Private Sub UserForm_Click()
68.
69. End Sub
1. VBA.
2. .
3. ?
4. , .
5. With.
6. Save SaveAs.
7. , , .
8.
9. VBA?
1. .. , .. , .. , .. ++: . : , 2009 108 .
|
|
2. .. , .. , .. , .. , .. , .. : . : , 2007 301.
3. .. Visual Basic. . .: -, 2004.288.
4. . , .. , .. , .. VBA: . : , 2007 162.
5. VBA.