Userform "Invalid property value" Error When Unloaded

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,562
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a form in my project. Very simple, one combobox. The user simply enters a value of 1-6. ENtering a valid value in the combobox closes the userform and code continues based on the information provided by the user.
When the user form closes, I am getting an error. Mircrosoft Forms Error: "Invalid property value"

Suppose I select "1" from the combox. It goes to routine "pop_Dsvc". I unload the userform at the top of this procedure with "Unload frm_select". No negative consequences resul in the rest of the application following this error to my knowledge. It just simply breaks the flow.

Here is the code associated with my form:
VBA Code:
Private Sub ComboBox1_Change()
'Stop
    If Not mbevents Then Exit Sub
    ui1 = ComboBox1.Value
    If ui1 = "1" Then
        pop_Dsvc 'svcnum
    ElseIf ui1 = "2" Then
        pop_Fsvc 'svcnum
    ElseIf ui1 = "3" Then
        pop_Csvc 'svcnum
    ElseIf ui1 = "4" Then
        pop_Tsvc 'svcnum
    ElseIf ui1 = "5" Then
        pop_Psvc 'svcnum
    ElseIf ui1 = "6" Then
        selectAll
    ElseIf ui1 = "7" Then
        'Stop
        With ws_front
            Unload frm_select
            .Shapes("ins_crewpkgs_output").Visible = True
            .Shapes("ins_crewpkgs_output").OnAction = "crewpkgs1"
            .Shapes("oos_crewpkgs_output").Visible = False
        End With
    Else
        mbevents = False
        combox1.Value = "6"
        mbevents = True
    End If
End Sub


Private Sub UserForm_Initialize()
    mbevents = False
    ComboBox1.Value = ""
    mbevents = True
End Sub
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Solved.
Match Required property was set to true. Changed to false and no error. Don't really understand why, but it worked.
 
Upvote 0

Forum statistics

Threads
1,213,537
Messages
6,114,216
Members
448,554
Latest member
Gleisner2

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