以下是引用兰色幻想在2005-1-28 13:04:00的发言:
你是在TextBox4_Enter事件中输入的代码,当然光标进入TEXTBOX4后代码就执行了
应该改为TextBox4_Exit事件
谢谢兰老师,我已改正了。但仍有一个问题,我将原来的代码:
Private Sub Label1_Click()
End Sub
Private Sub Label2_Click()
End Sub
Private Sub Label3_Click()
End Sub
Private Sub Label4_Click()
End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub TextBox2_Change()
End Sub
Private Sub TextBox3_Change()
End Sub
Private Sub TextBox4_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim a As Integer
a = Range("a65536").End(xlUp).Row + 1
Cells(a, 1) = TextBox1
Cells(a, 2) = TextBox2
Cells(a, 3) = TextBox3
Cells(a, 4) = TextBox4
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox1.SetFocus
End Sub
前面黄色部分删除,只保留最后一部分仍然可以调出记录单并可以录入正确。但是每次必须全部录入“ABCD”四个字段才能录入单元格,如果有缺省则无法通过记录单位录入。请帮助。谢谢!! |