• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Disable userform OK button until all fields are filled

Hello,


I have to imagine this has been asked before....but I cannot seem to find a solution that has worked for my situation:


I want to ensure that every field in my userform is completed before the OK button is enabled. In total the userform contains 9 textboxes, 2 combo boxes and 1 list box.


I would really appreciate it if someone could help or point me in the right direction.


Thank you!


SAMPLE FILE:

https://www.dropbox.com/s/f1b552ohssfxw5w/userform_demo1.xlsm
 
You need to add a Function to check all the user form controls and then call that function when any controls change


Have a look here:

https://www.dropbox.com/s/7kym5l33o8dee35/Userform_demo1_Hui.xlsm
 
Hi Hui ,


I tried out your file , and I find that I need to replace the following code :

[pre]
Code:
Private Sub lb_Region_AfterUpdate()
Check_All_Fields
End Sub
by the following :

Private Sub lb_Region_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Check_All_Fields
End Sub
[/pre]
for it to work.


Narayan
 
I think I had already placed a value in the List box and that would explain why my version worked

But your correct if that is the last field populated
 
Back
Top