PC Review


Reply
Thread Tools Rate Thread

check userform values in combination

 
 
mcgurkle
Guest
Posts: n/a
 
      11th Jun 2007
I have a userform with a number of combo boxes. I would like to be
able to compare all the values, which the user has selected, with a
table on a spreadsheet. The top axis of the table has all the combobox
names on it, and the vertical axis is just numbers from 1 to N. Each
cell in a row of the table may contain a possible value of the combo
box, whose name is at the top of its column. The cell may also be
blank; this represents a don't-care. Each row then represents a
combination of values which are forbidden on the form.

EG. The table might look like this:

¦Combo1Name ¦Combo2Name ¦Combo3Name ¦Combo4Name
-------------------------------------------------------------------------------------------------------------------------------------
1 ¦Value1 ¦ ¦ValueTuesday ¦ValueMay
2 ¦Value1 ¦Valueb ¦ ¦
3 ¦Value3 ¦ ¦ ¦ValueJuly

Meaning that the values, as represented in rows 1, 2 and 3, cannot be
chosen in combination. If they are, I plan to make a warning appear.
I think I should check this on the change event of the combo boxes,
but I'm just not sure how to go about checking the combinations of
values against the table.
I'd be most grateful for any ideas.

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      11th Jun 2007
Private Sub ComboBox1_Change()

If Not IsError(Application.Match(ComboBox1.Value, _
Worksheets("Sheet1").Columns(1),0) Then
Msgbox "Found"
Else
MsgBox "Not found"
End If
End Sub

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"mcgurkle" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
I have a userform with a number of combo boxes. I would like to be
able to compare all the values, which the user has selected, with a
table on a spreadsheet. The top axis of the table has all the combobox
names on it, and the vertical axis is just numbers from 1 to N. Each
cell in a row of the table may contain a possible value of the combo
box, whose name is at the top of its column. The cell may also be
blank; this represents a don't-care. Each row then represents a
combination of values which are forbidden on the form.

EG. The table might look like this:

¦Combo1Name ¦Combo2Name ¦Combo3Name ¦Combo4Name
-------------------------------------------------------------------------------------------------------------------------------------
1 ¦Value1 ¦ ¦ValueTuesday ¦ValueMay
2 ¦Value1 ¦Valueb ¦ ¦
3 ¦Value3 ¦ ¦ ¦ValueJuly

Meaning that the values, as represented in rows 1, 2 and 3, cannot be
chosen in combination. If they are, I plan to make a warning appear.
I think I should check this on the change event of the combo boxes,
but I'm just not sure how to go about checking the combinations of
values against the table.
I'd be most grateful for any ideas.


 
Reply With Quote
 
mcgurkle
Guest
Posts: n/a
 
      11th Jun 2007
On Jun 11, 1:16 pm, "Bob Phillips" <bob....@somewhere.com> wrote:
> Private Sub ComboBox1_Change()
>
> If Not IsError(Application.Match(ComboBox1.Value, _
> Worksheets("Sheet1").Columns(1),0) Then
> Msgbox "Found"
> Else
> MsgBox "Not found"
> End If
> End Sub
>
> --
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>
> "mcgurkle" <Laura.McG...@gmail.com> wrote in message
>
> news:(E-Mail Removed)...
> I have a userform with a number of combo boxes. I would like to be
> able to compare all the values, which the user has selected, with a
> table on a spreadsheet. The top axis of the table has all the combobox
> names on it, and the vertical axis is just numbers from 1 to N. Each
> cell in a row of the table may contain a possible value of the combo
> box, whose name is at the top of its column. The cell may also be
> blank; this represents a don't-care. Each row then represents a
> combination of values which are forbidden on the form.
>
> EG. The table might look like this:
>
> ¦Combo1Name ¦Combo2Name ¦Combo3Name ¦Combo4Name
> ---------------------------------------------------------------------------*----------------------------------------------------------
> 1 ¦Value1 ¦ ¦ValueTuesday ¦ValueMay
> 2 ¦Value1 ¦Valueb ¦ ¦
> 3 ¦Value3 ¦ ¦ ¦ValueJuly
>
> Meaning that the values, as represented in rows 1, 2 and 3, cannot be
> chosen in combination. If they are, I plan to make a warning appear.
> I think I should check this on the change event of the combo boxes,
> but I'm just not sure how to go about checking the combinations of
> values against the table.
> I'd be most grateful for any ideas.


Hi Bob,

Thanks for the quick reply. If I understand correctly, this will check
the value of the combo box individually against the value on the
spreadsheet. If at all possible, I would like to check the value
selected in the combo box - in combination with the values on the
other combo boxes on the userform. That is to say, a warning will only
appear if the values on the same row of the lookup table are selected
at the same time in their respective combo boxes.

So it's ok if I select "Value1" in combo box 1 and "Valuea" in combo
box 2, and it's also ok if I select "Value2" in combo box 1 and
"Valueb" in combo box 2, but if I select "Value1" in combo box 1 and
"Valueb" in combo box 2, then a warning appears.

Is there a way to apply your code to this problem?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check if Combination exists newguy Microsoft Excel Misc 3 5th Aug 2010 09:54 PM
Return all values but only the same combination once. =?Utf-8?B?Sm9obg==?= Microsoft Access 4 2nd Oct 2007 04:05 PM
Userform to enter values and shown in same userform in list helmekki Microsoft Excel Programming 0 19th Nov 2005 03:23 PM
Check UserForm Values Before Saving MBlake Microsoft Excel Programming 13 11th May 2005 11:24 PM
Q on how to find best combination of values Brian Bucher Microsoft Excel Misc 2 31st Jul 2003 02:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:46 AM.