.
3 : , .
.
, .
VBA.
.
1 : . - UserForm.
2 : - - VisualBasic - UserForm.
(), . .
Label | |
TextBox | |
Frame | |
CommandButton | |
ComboBox | |
CheckBox | |
OptionButton | |
ListBox | |
ScrollBar | |
SpinButton |
.
. , , CheckBox1.
.
() .
.
, .
.
. Value True, False .
. , . . Value True, False .
, .
. Value , . Min Max .
() .
1. , . .
"1" :
B C D
1
, 2 ( ), 2 2 . , .
|
|
Label2 |
TextBox2 |
CommandButton2 |
TextBox1 |
CommandButton1 |
Label1 |
:
Label1 | Caption | |
Label2 | Caption | |
CommandButton1 | Caption | |
CommandButton2 | Caption |
:
Private Sub CommandButton2_Click()
End
End Sub
:
Option Explicit
Private Sub CommandButton1_Click()
Dim , As String
Dim Row As Integer
Row = Application.CountA(Sheets("1").Range(":")) + 1
With UserForm1
=.TextBox1.Text
=.TextBox2.Text
End With
With Sheets("1")
.Cells(Row, 1).Value =
.Cells(Row, 2).Value =
End With
With UserForm1
.TextBox1.Text = ""
.TextBox2.Text = ""
End With
End Sub
:
VBA ":" . xcel . CountA. ..
Row = Application.CountA(Sheets("1").Range(":")) + 1
.
Row 1 , .
With End With .
,
With Sheets("1")
.Cells(Row, 1).Value =
.Cells(Row, 2).Value =
End With
With End With :
Sheets("1").Cells(Row, 1).Value =
Sheets("1").Cells(Row, 2).Value =
Sheets Cells VBA, .
F5 " ". Excel, . ,
Sub 1_()
UserForm1.Show
End Sub
( ). .
2. , 2 , 2 2 . , , 1 .
OptionButton1 |
Label1 |
CommandButton1 |
:
OptionButton2 |
Label2 |
CommandButton2 |
:
Label1 | Caption | |
Label2 | Caption | |
CommandButton1 | Caption | |
CommandButton2 | Caption |
, .
|
|
!!! , Loked False.
:
Private Sub CommandButton2_Click()
End
End Sub
:
Option Explicit
Private Sub CommandButton1_Click()
Dim As String
With UserForm1
If.OptionButton1 = True Then = ""
If.OptionButton2 = True Then = ""
End With
With Sheets("1")
.Cells(1, 1) =
End With
End Sub
3. , 2 , 2 2 . , 1 2 "", "".
CheckBox1 |
Label1 |
CommandButton1 |
:
CheckBox2 |
Label2 |
CommandButton2 |
:
Label1 | Caption | |
Label2 | Caption | |
CommandButton1 | Caption | |
CommandButton2 | Caption |
"" , "" .
!!! Locked False.
:
Private Sub CommandButton2_Click()
End
End Sub
:
Option Explicit
Private Sub CommandButton1_Click()