UserForm make option button and textboxes mandatory

Xalova

Board Regular
Joined
Feb 11, 2021
Messages
80
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
Okay. So i have created a userform with several textboxes and optionbuttons.

What i have achieved until now is that ceartain textboxes are mandatory and have to be filled. But i dont seem to get it with the optionbuttons and i dont know why.

the if statement is as follows:

VBA Code:
If Me.ADA.Value <> "" And Me.datummat.Value <> "" And Me.KommNr.Value <> "" And Me.Empfänger.Value <> "" And Me.Artikel.Value <> "" And (Me.Ausgabe.Value = "wahr" Or Me.Rücknahme.Value = "wahr") Then

now you may think that the statement
VBA Code:
Me.Ausgabe.Value = "wahr"
could be the error. But i have tried the whole if statement without the textboxes and it worked as i wanted it to work, so it shouldnt be the error, right?

i dont know how i solve this problem. I need help.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
On a Userform typically only one Option Button can be selected.
Unless you have them in Frames.
 
Upvote 0
On a Userform typically only one Option Button can be selected.
Unless you have them in Frames.
i mean yes, but i want to kinda "force" the user to select an option button.

kinda like
"do not accept if no optionbutton is selected"

do you get what i mean?
 
Upvote 0
i mean yes, but i want to kinda "force" the user to select an option button.

kinda like
"do not accept if no optionbutton is selected"

Try adding line like following & see if does what you want

VBA Code:
'both optionbuttons False
If Not Me.Ausgabe.Value And Not Me.Rücknahme.Value Then MsgBox "Selection Required": Exit Sub

Dave
 
Upvote 0
Try adding line like following & see if does what you want

VBA Code:
'both optionbuttons False
If Not Me.Ausgabe.Value And Not Me.Rücknahme.Value Then MsgBox "Selection Required": Exit Sub

Dave
sadly this did not work.

also i need it in ADDITION to textboxes, which have to be filled.
 
Upvote 0
sadly this did not work.

also i need it in ADDITION to textboxes, which have to be filled.

Not sure why - if both OptionButtons are False should display the msgbox & exit sub

Helpful if you can post all the code for forum to give better idea of what you are doing.

Dave
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

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