我正在尝试编写一些VBA代码,而且几乎所有东西都运行良好。我只需要一点帮助。
这是我的代码:
'input if supervisor=fill in supervisor missing
If UserForm1.superbox.Text = "Fill In Supervisor" Then
If UserForm1.fillbox.Text = "(Fill In Supervisor)" or UserForm1.fillbox.Text = "" Then
MsgBox ("Please Enter a Fill In Supervisor.")
Exit Sub
End If
End If
使用这些条件运行后,Exit Sub
失败。
答案 0 :(得分:1)
我搞砸了一会儿,我想出了:
'input if supervisor=fill in supervisor missing
Dim fis As Boolean
fis = False
If UserForm1.superbox.Text = "Fill In Supervisor" Then
While Not fis
If UserForm1.fillbox.Text = "(Fill In Supervisor)" Or UserForm1.fillbox.Text = "" Then
MsgBox ("Please Enter a Fill In Supervisor.")
Exit Sub
ElseIf UserForm1.fillbox.Text <> "(Fill In Supervisor)" Or UserForm1.fillbox.Text <> "" Then
fis = True
End If
Wend
End If
到目前为止,代码效果很好!