Private Sub CommandButton1_Click()
lastrow = Worksheets("数据").Cells(Rows.Count, 1).End(xlUp).Row + 1
With Range(Cells(lastrow, 1), Cells(lastrow, 6)).Borders
.LineStyle = xlContinuous
.Weight = xlThin
End With
Worksheets("数据").Cells(lastrow, 1).value = TextBox1.Text
If OptionButton1.value = True Then
Worksheets("数据").Cells(lastrow, 2).value = "男性"
End If
If OptionButton2.value = True Then
Worksheets("数据").Cells(lastrow, 2).value = "女性"
End If
If CheckBox1.value = True Then
Worksheets("数据").Cells(lastrow, 3).value = "是"
End If
If CheckBox2.value = True Then
Worksheets("数据").Cells(lastrow, 4).value = "是"
End If
If CheckBox3.value = True Then
Worksheets("数据").Cells(lastrow, 5).value = "是"
End If
Worksheets("数据").Cells(lastrow, 6).value = ListBox1.value
End Sub
Private Sub CommandButton2_Click()
TextBox1.Text = ""
OptionButton1.value = False
OptionButton2.value = False
CheckBox1.value = False
CheckBox2.value = False
CheckBox3.value = False
End Sub
Private Sub CommandButton3_Click()
Unload UserForm1
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub UserForm_Initialize()
Dim i As Integer
r = Worksheets("省份").Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To r
ListBox1.AddItem Worksheets("省份").Cells(i, 1).value
Next
End Sub