Userform reappears when closing worksheet

Nadine67

Board Regular
Joined
May 27, 2015
Messages
225
Hello and thank you for any attention my post may receive.

I have a userform (frmCalendar) which appears when I click a specific cell (C4) on a worksheet (Scorecard).

The problem I have is that when I close the worksheet through a 'Save' command button and selecting 'Yes' in the message box, the form reappears and I have to close it manually. How do I stop it from appearing other than only when I select the target cell?

Message box code
Code:
    If ActiveSheet.Range("H9") < 9 Then
            MsgBox "Hang on a bit " & myName & ".  You have not completed all required fields." & vbNewLine & vbNewLine & _
            "Select OK and have another go.", , "Hey wait a sec....."
    
    Else
            Msg = "Thank you for completing the Scorecard " & myName & "." & vbNewLine & vbNewLine & _
            "Select 'Yes' to save the results, after doing so this audit will be unavailable for editing." & vbNewLine & vbNewLine & _
            "'No' will return to the sheet."
            Ans = MsgBox(Msg, vbYesNo + vbQuestion, "Hang on and think about what you are planning to do........") ', vbExclamation)
    End If
    Select Case Ans
        Case vbYes
            Application.DisplayAlerts = False
            Set ws1 = ActiveSheet
            Set ws2 = Sheets("Audit_Log")
            Set ws3 = Sheets("INSTRUCTIONS")
            Set ws4 = Sheets("Constants")
            Set ws5 = Sheets("Action_Log")
            pdfname = "5S_Audit_" & Range("B8").value & "_" & Range("D4").value & " - " & Format(Range("B4"), "yyyymmdd")
            pdffilename = "S:\12.MGMT\BEx\5S\Audits and Schedules\Audit Scorecards\" & pdfname

This is so frustrating.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
You could try Application.EnableEvents=False in the Case code (but it will need setting back to true at some point).
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top