I have the following userform:
At this moment, I have several message boxes that make sure all necessary fields are completed/selected.
Example #1:
If CheckBox4 is Selected -> Is Number Box 4 or Text Box 4 selected? -> If not, there's a MsgBox warning.
If CheckBox4 is Selected -> is Weight Box 4 field empty? -> If yes, there's a MsgBox warning.
If Number box 4 is selected -> Is Normalization Box 4 selected? -> If not, there's a MsgBox warning.
Example code of one of this warnings:
' Make sure if additional metrics are selected : number or text is selected
If CheckBox1 = True And (NumBox1 = False And TxtBox1 = False) Then
MsgBox ("Please define if the metric is numerical or text.")
Exit Sub
End If
If CheckBox2 = True And (NumBox2 = False And TxtBox2 = False) Then
MsgBox ("Please define if the metric is numerical or text.")
Exit Sub
End If
(...)
It works and does the job, but it's a lot of code.
Ideally I'd like to find a way to compile all these "warnings" into a single MsgBox.
Additional info:
CheckBox1 / NumBox1 / TxtBox1 / NorBox1 / WBox1
CheckBox2 / NumBox2 / TxtBox2 / NorBox2 / WBox2
etc.
These are the names attributed to each control.
Tbh, I have no idea how to go on this since I'm veeeeery new to VBA. Any help you can give me is really appreciated. :)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…