• 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.

Case Select Multiple Answers

Hello, I'm new to VBA.


Here is the situation, I have a UserForm, and in the user form I have several ComboBoxes, CheckBoxes and TextBoxes.


I cannot get the code below to work properly and am asking for a little help.

Here is what I want it to do:

ComboBox = Have & CheckBox = False put "Do Not Contact" in the TextBox OR

ComboBox = None & CheckBox = False put "Contact" in the TextBox


Here is the code I'm trying to use:

Select Case CbxCOBRA.Value

Case "Have", "None" 'The client either has it or not.

CbxCOBRA.Value = "Have"

Case Else

CbxCOBRA.Value = "None"

Select Case cbCOBRA2.Value 'If the CheckBox is unchecked then populate TextBox10

Case False


'This is giving me some issues, I need it to choose between the two below

TextBox10 = resString = resString & Delimiter & "Do Not Contact"

TextBox10 = resString = resString & Delimiter & "Contact"


End Select

End Select
 
Hi, msquared99!


Consider uploading a sample file (including manual examples of desired output), it'd be very useful for those who read this and might be able to help you. Thank you.


Despite of this, in the code you posted I notice that in 2nd & 3rd lines there's something strange and redundant or not needed:

Case "Have", "None"

CbxCOBRA.Value = "Have"

if the CbxCOBRA.Value already has a "Have" value, why assigning it again?


Regards!
 
From what you have, I think the structure would be easier to check using some IF statements. Roughly, this is what you said

[pre]
Code:
If CheckBox.Value = False Then
If ComboBox.Value = "Have" Then
xMsg = "Do Not Contact"
ElseIf ComboBox.Value = "Non" Then
xMsg = "Contact"
Else
'What if the combobox is not one of the above?
End If
Else
'What if checkbox is true?
End If
TextBox.Value = xMsg
[/pre]
 
Back
Top