How to go back or re-display Userform after hiding it?

前端 未结 2 824
悲&欢浪女
悲&欢浪女 2021-01-22 22:14

I have this code in one command button in UserForm2:

 Private Sub CButton1_Click()
     UserForm1.Show
     Me.Hide
 End Sub

Now, Userfor

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-22 22:38

    I think the problem is the order of the statements. I found out by using the debugger that when I had the Show statements before the Hide or Unload, these last are not executed.

    Try this

    ' on UserForm2
    Private Sub CommandButton1_Click()
        Me.Hide
        UserForm1.Show
    End Sub
    
    ' on UserForm1
    Private Sub CommandButton1_Click()
        Me.Hide
        UserForm2.Show
    End Sub
    

提交回复
热议问题