Hello:
I am using a userform which requires a user to enter data into a sheet, but if they skip a field they get a message requiring the data. Yet, when I run the code, it works, but if I click a button, it gives the message as well. See my code below. I am messing up somewhere. I want it to check to see if btnADMIN is clicked, and if it is, it won't give me a Required field message. Everything else it does. Any suggestions?
I am using a userform which requires a user to enter data into a sheet, but if they skip a field they get a message requiring the data. Yet, when I run the code, it works, but if I click a button, it gives the message as well. See my code below. I am messing up somewhere. I want it to check to see if btnADMIN is clicked, and if it is, it won't give me a Required field message. Everything else it does. Any suggestions?
Code:
Private Function Is_Control_Blank(ctrl As MSForms.Control) As Boolean
Is_Control_Blank = False
[B]If Trim(ctrl.Name) = btnADMIN Then End Sub
[/B] ElseIf Trim(ctrl.Value) = "" Then
MsgBox "Required Field", vbInformation + vbOKOnly, "FY 12 Costing Template"
Is_Control_Blank = True
End If
End Function