Userform problem

Roccafelie

Board Regular
Joined
Jun 30, 2008
Messages
129
Hello Everyone

I am looking for a macro or code that if a field not filled or choosen in userform, there will be a error message says "cant continue, please make sure all fields are filled etc..)

I believe it s asked before, but I cant find the relevant thread.

I ll be hapy, if you could give me a hand with that

Thanks
 
OK, first of all sorry for the many replies but this is a headache already for me and possibly for you because i really don't know how to use this forum thing. I got it to work (almost and finally) but now I'm required to check both boxes instead of just one. I need something like an "if! cbx1 is not fille then cbx2 must be and if none then error": This is how I fixed part of it already:

If CheckBox1.Value = False Then
MsgBox "Por favor complete o formulário"
CheckBox1.SetFocus
Exit Sub
End If

If CheckBox2.Value = False Then
MsgBox "Por favor complete o formulário"
CheckBox2.SetFocus
Exit Sub
End If
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try:

Code:
If CheckBox1.Value = False Then
    MsgBox "Por favor complete o formulário"
    CheckBox1.SetFocus
    Exit Sub
ElseIf CheckBox2.Value = False Then
    MsgBox "Por favor complete o formulário"
    CheckBox2.SetFocus
    Exit Sub
End If
 
Upvote 0
Dear Mr. A. Poulson: Thank you for all your help but that did not work either. I finally figured it out. Here's the code for you.

If CheckBox1.Value = False And CheckBox2.Value = False Then
MsgBox "Por favor complete o formulário"
CheckBox1.SetFocus
Exit Sub
End If
If CheckBox2.Value = False And CheckBox1.Value = False Then
MsgBox "Por favor complete o formulário"
CheckBox2.SetFocus
Exit Sub
End If
 
Upvote 0

Forum statistics

Threads
1,214,792
Messages
6,121,612
Members
449,039
Latest member
Mbone Mathonsi

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