Private Sub CommandButton1_Click() If TextBox1.Value = "" And TextBox2.Value = "" And TextBox3.Value = "" Then MsgBox "数值不能为空" TextBox1.SetFocus End If
Private Sub CommandButton1_Click() Dim i% For i = 1 To 3 If Me.Controls("textbox" & i) = "" Then MsgBox "µÚ" & i & "¸öÎı¾¿òÊÇ¿ÕµÄ,ÏÖÔÚÍ˳ö³ÌÐò!" Controls("textbox" & i).SetFocus Exit For End If Next End Sub