|
楼主 |
发表于 2024-4-1 10:12
|
显示全部楼层
本帖最后由 雪之花 于 2024-4-1 10:20 编辑
自己小修改后调试可以了,谢谢老师!
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
If TextBox1.Text = "" Then Exit Sub
zd = TextBox1.Text
With Sheets("换料比较")
r = .Cells(Rows.Count, 4).End(xlUp).Row + 1
.Cells(r, 3) = zd
End With
TextBox1.Text = Split(zd, "|")(0)
TextBox2.SetFocus
End If
End Sub
Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
If TextBox2.Text = "" Then Exit Sub
zd = TextBox2.Text
With Sheets("换料比较")
r = .Cells(Rows.Count, 4).End(xlUp).Row + 1
.Cells(r, 4) = zd
TextBox2.Text = Split(zd, "|")(0)
If TextBox1.Text = TextBox2.Text Then
.Cells(r, 5) = "OK"
Application.SendKeys "{TAB}"
Application.SendKeys "{TAB}"
Else
.Cells(r, 5) = "NG"
Application.SendKeys "{TAB}"
End If
End With
TextBox1.SetFocus
End If
End Sub
|
|