在下面的程序中,我收到此错误:运行时错误'-2147467259(80004005)':未指定错误。在此行中突出显示以下代码:txtStartDate.SetFocus
:If txtStartDate.Text = "" Then txtStartDate.SetFocus
Private Sub txtTimeUnit_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If IsError(Application.Match(txtTimeUnit.Text, Range("intTable[Units]"), 0)) Then
lblStatusBar = "Please correct value."
Cancel = True
Exit Sub
End If
lblStatusBar = vbNullString
Range("CToDate").Value = txtTimeUnit.Text
If txtStartDate.Text = "" Then txtStartDate.SetFocus
If txtEndDate.Text = "" Then txtEndDate.SetFocus
End Sub
任何人都可以帮我解决这个错误并将文本框焦点(光标)传递给另一个文本框吗?
答案 0 :(得分:3)
替换
If txtStartDate.Text = "" Then txtStartDate.SetFocus
通过
If txtStartDate.Text = "" Then
txtStartDate.SetFocus
Exit Sub
End If