|
xubiao1982 发表于 2012-6-25 13:40
老师,
好!
光标是留住了,但其他的box都不能用了,烦看看我代码是否还有其他问题。
Dim temp%
Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim str As String
Dim r As Integer
r = Cells(Rows.Count, 1).End(xlUp).row
str = Format(Now, "yyyymmdd") & Chr(13)
If KeyCode = vbKeyReturn Then
temp = KeyCode
With Sheets(str)
Cells(r + 1, 1) = TextBox2.Text
TextBox2.Text = ""
Cells(r + 1, 2) = ComboBox1.Text
Cells(r + 1, 3) = ComboBox2.Text
Cells(r + 1, 4) = ComboBox3.Text
Cells(r + 1, 5) = ComboBox4.Text
Cells(r + 1, 6) = ComboBox5.Text
Cells(r + 1, 7) = TextBox1.Text
TextBox2.SetFocus
End With
End If
End Sub
Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If temp = 13 Then
temp = 0
Cancel = True
End If
End Sub
|
|