|
Private Sub CommandButton1_Click()
If TextBox2.Value = "" Then MsgBox "未填姓名": Exit Sub
If TextBox3.Value = "" Then MsgBox "未填班别": Exit Sub
If TextBox5.Value = "" Then MsgBox "未填英语成绩": Exit Sub
If TextBox1.Value = "" Then MsgBox "未填学号": Exit Sub
If TextBox6.Value = "" Then MsgBox "未填计算机成绩": Exit Sub
If TextBox4.Value = "" Then MsgBox "未填语文成绩": Exit Sub
Dim rn As Range
r = Cells(Rows.Count, 1).End(xlUp).Row
zd = TextBox4.Value
Set rn = Range("a1:a" & r).Find(zd, , , , , , 1)
If Not rn Is Nothing Then MsgBox "学号重复!": Exit Sub
ZF = Val(TextBox4.Value) + Val(TextBox5.Value) + Val(TextBox6.Value)
For i = 1 To 6
Cells(r + 1, i) = Me.Controls("TextBox" & i).Value
Me.Controls("TextBox" & i).Value = ""
Next i
Cells(r + 1, 7) = ZF
End Sub
Private Sub CommandButton2_Click()
Dim rn As Range
rS = Cells(Rows.Count, 1).End(xlUp).Row
zd = TextBox1.Value
Set rn = Range("a1:a" & rS).Find(zd, , , , , , 1)
If rn Is Nothing Then MsgBox "学号不存在!": Exit Sub
r = rn.Row
For i = 1 To 6
Me.Controls("TextBox" & i).Value = Cells(r, i)
Next i
End Sub
|
|