You cannot unload the userform from within the UserForm_Initialize procedure.
You could...
1.) check condition before you initialize the userform
2.) or check the condition in the UserForm_Activate event. The _Activate event is called after the form has been initialized e.g....
Private Sub UserForm_Activate()
If Range("B4") = "z, row" Then
If MsgBox("This worksheet has only one employee. A new employee must be added before the current employee can be removed", _
vbOK, "Minimum Employee Warning") = vbOK Then Unload Me
End If
End Sub
Private Sub UserForm_Initialize()
'form code here
End Sub
Bookmarks