Скачать презентацию
Идет загрузка презентации. Пожалуйста, подождите
Презентация была опубликована 9 лет назад пользователемАнастасия Неретина
1 Ближайшее простое Public Sub Пр() Dim Ol As Integer, Op As Integer, i As Integer, n1 As Integer Dim N As Integer Dim t As Integer Dim mystr As String N = Val(InputBox(«Введите" + Chr(10) + " N", «Ввод исходных данных")) If N <= 3 Then t = N Else If N Mod 2 = 0 Then Ol = N - 1 Op = N + 1 Else Op = N + 2 Ol = N End If
2 Продолжение i = Ol While Not Prostoe(i) i = i - 2 Wend n1 = i i = Op While Not Prostoe(i) i = i + 2 Wend If N - n1 <= i - n1 Then t = n1 Else t = i End If MsgBox (Ближайшее" + Chr(10) + Chr(13) + Str(t)) End Sub
3 Пример формы
"" Then C1.Enabled = True C2.Enabled = True C3.Enabled = True If Val(T2.Text) <> 0 Then C4.Enabled = True Else C1.Enabled = False C2.Enabled = Fa" title="Изменение текста в первом поле Private Sub T1_Change() T3.Text = T1.Text If T1.Text <> "" And T2.Text <> "" Then C1.Enabled = True C2.Enabled = True C3.Enabled = True If Val(T2.Text) <> 0 Then C4.Enabled = True Else C1.Enabled = False C2.Enabled = Fa" class="link_thumb"> 4 Изменение текста в первом поле Private Sub T1_Change() T3.Text = T1.Text If T1.Text <> "" And T2.Text <> "" Then C1.Enabled = True C2.Enabled = True C3.Enabled = True If Val(T2.Text) <> 0 Then C4.Enabled = True Else C1.Enabled = False C2.Enabled = False C3.Enabled = False C4.Enabled = False End If End Sub "" Then C1.Enabled = True C2.Enabled = True C3.Enabled = True If Val(T2.Text) <> 0 Then C4.Enabled = True Else C1.Enabled = False C2.Enabled = Fa"> "" Then C1.Enabled = True C2.Enabled = True C3.Enabled = True If Val(T2.Text) <> 0 Then C4.Enabled = True Else C1.Enabled = False C2.Enabled = False C3.Enabled = False C4.Enabled = False End If End Sub"> "" Then C1.Enabled = True C2.Enabled = True C3.Enabled = True If Val(T2.Text) <> 0 Then C4.Enabled = True Else C1.Enabled = False C2.Enabled = Fa" title="Изменение текста в первом поле Private Sub T1_Change() T3.Text = T1.Text If T1.Text <> "" And T2.Text <> "" Then C1.Enabled = True C2.Enabled = True C3.Enabled = True If Val(T2.Text) <> 0 Then C4.Enabled = True Else C1.Enabled = False C2.Enabled = Fa">
"" And T2.Text <> "" Then C1.Enabled = True C2.Enabled = True C3.Enabled = True If Val(T2.Text) <> 0 Then C4.Enabled = True Else C1.Enabled = False C2.Enabled = False " title="Изменение текста во втором поле Private Sub T2_Change() T4.Text = "" If T1.Text <> "" And T2.Text <> "" Then C1.Enabled = True C2.Enabled = True C3.Enabled = True If Val(T2.Text) <> 0 Then C4.Enabled = True Else C1.Enabled = False C2.Enabled = False " class="link_thumb"> 5 Изменение текста во втором поле Private Sub T2_Change() T4.Text = "" If T1.Text <> "" And T2.Text <> "" Then C1.Enabled = True C2.Enabled = True C3.Enabled = True If Val(T2.Text) <> 0 Then C4.Enabled = True Else C1.Enabled = False C2.Enabled = False C3.Enabled = False C4.Enabled = False End If End Sub "" And T2.Text <> "" Then C1.Enabled = True C2.Enabled = True C3.Enabled = True If Val(T2.Text) <> 0 Then C4.Enabled = True Else C1.Enabled = False C2.Enabled = False "> "" And T2.Text <> "" Then C1.Enabled = True C2.Enabled = True C3.Enabled = True If Val(T2.Text) <> 0 Then C4.Enabled = True Else C1.Enabled = False C2.Enabled = False C3.Enabled = False C4.Enabled = False End If End Sub"> "" And T2.Text <> "" Then C1.Enabled = True C2.Enabled = True C3.Enabled = True If Val(T2.Text) <> 0 Then C4.Enabled = True Else C1.Enabled = False C2.Enabled = False " title="Изменение текста во втором поле Private Sub T2_Change() T4.Text = "" If T1.Text <> "" And T2.Text <> "" Then C1.Enabled = True C2.Enabled = True C3.Enabled = True If Val(T2.Text) <> 0 Then C4.Enabled = True Else C1.Enabled = False C2.Enabled = False ">
6 Обработка нажатия клавиши Private Sub T1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If KeyAscii Asc("9") Then KeyAscii = 0 End Sub
7 Обработка ссылок
8 Обработка диапазона Private Sub CommandButton1_Click() Dim a As Range Dim i As Variant, s As Variant Set a = Range(Re1.Text) For Each i In a s = s + i Next i T1.Text = Str(s) End Sub
9 Форма со списком
10 Создать список Private Sub b1_Click() L1.Clear a = Val(t1.Text) b = Val(t2.Text) For i = a To b L1.AddItem (Str(i)) Next i End Sub
11 Заполнение списка простыми числами Private Sub b1_Click() L1.Clear a = Val(t1.Text) b = Val(t2.Text) For i = a To b If Prostoe(i) Then L1.AddItem (Str(i)) Next i End Sub
12 Перемещение из списка L1 в список L2 Private Sub C1_Click() If L1.ListCount > 0 Then If L1.ListIndex = -1 Then L1.ListIndex = L1.ListCount - 1 L2.AddItem (L1.Text) L1.RemoveItem (L1.ListIndex) End If End Sub
13 Загрузка форм Load объект – позволяет загрузить форму без отображения на экране; Useform.Show - отображает форму на экране; Useform.Hide - скрывает форму на экране; Unlooad объект – позволяет выгрузить форму;
Еще похожие презентации в нашем архиве:
© 2024 MyShared Inc.
All rights reserved.