VBA code shows “Else without if error”

前端 未结 2 974
别跟我提以往
别跟我提以往 2021-01-24 11:40

I have been trying to fix it but was not able to, although it\'s a very small code: Please help, it\'s showing an \"else without if\" error:

Private Sub Workbook         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-24 12:25

    You can do this more concisely and avoid using GOTO to control the flow of the program (which is generally a good idea) with a simple loop;

    Dim pass As String
    
    Do
        pass = InputBox("Enter Password")
        If pass = "hummer" Then Exit Do
    Loop
    

提交回复
热议问题