如何允许用户在do while循环中输入用户信息?

时间:2019-04-20 16:53:19

标签: vba loops while-loop userform

我厌倦了准备用户表单,以便在某些情况下输入工作表并处理一些工作。主要问题是当我开始执行宏时,while循环执行试用时间,但不允许在文本框中输入每次试用的新字符串。

Private Sub CommandButton1_Click()

    Dim x As String, range As range, i As Integer
    Do While i < 2
    If TextBox1.Text = "excel" And TextBox2.Text = "vba" Then
         Sheets("list").Visible = True
         Sheets("list").Select
                  Exit Do
     Else
         MsgBox "WrongPass" & vbNewLine & vbNewLine & "Remain Trial: " & 2 - i
         Sheets("liste").Visible = False
         i = i + 1
         TextBox3.Text = 2 - i
     End If
     Loop
End Sub

0 个答案:

没有答案