Sub not ending after unloading userform and activating worksheet

30 views Asked by At

I'm using Userform1 to make 1 worksheet invisible (coverP) and making another worksheet visible (RstVer).

Private Sub CommandButton1_Click()    'sub in userform1
Application.ScreenUpdating = False: Debug.Print "1"
Application.Visible = True: Debug.Print "2"
RstVer.Visible = xlSheetVisible: Debug.Print "3"
RstVer.Activate: Debug.Print "4"
coverP.Visible = xlSheetHidden: Debug.Print "5"
Application.ScreenUpdating = True: Debug.Print "6"
End Sub

Private Sub Worksheet_Activate()
Application.ScreenUpdating = False: Debug.Print "7"
Unprotect "password": Debug.Print "8"
Range("K9") = CStr(stfList.Cells(100, 100).Value): Debug.Print "9"
Range("D37").End(xlUp).Select: Debug.Print "10"
Protect "password": Debug.Print "11"
Application.ScreenUpdating = True: Debug.Print "12"
End Sub

After clicking CommandButton1, coverP was hidden and RstVer was visible, but my workbook behaves like ScreenUpdating was disabled. After examining the developer, I found that sub (not sure which one) was still running. In the immediate window, I got 1 2 3 4 5 6, but not the other numbers I was expecting. Can you enlighten me on this?

0

There are 0 answers