Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'll try to keep this short. I have a form with a number of combobox's
(let's say 20). Each combobox represents a slot in a shelf. Each combobox points to the same list of cards. Certain slots can accept any card, whereas certain slots can only accept a few cards. I do not want to allow the run button to be selected until all slots contain the correct cards. I can accomplish this with the following code using many if statements for each combobox. Let's say CBox1 (slot-1), can contain any card except "card1 or card2) Private Sub CmdRun_Click() If (frmMaintest.CBox1.Text = "card1") Or (frmMaintest.CBox1.Text = "card2") Then MsgBox "You must select another name!" Exit Sub ElseIf (frmMaintest.CBox1.Text < "card1") Eqv (frmMaintest.CBox1.Text < "card2") Then MsgBox "This name is acceptable!" End If Range("d4").Select Selection.Value = frmMaintest.CBox1.Text Unload frmMaintest End Sub I have also accomplished this using Private Sub CBox1_Change() 'instead of the CmdRun_Click() QUESTIONS 1) Can the above "If" statements be shortened? 2) What I really want is for the combobox to "drop-down" and make you select the correct card before letting you select the next combobox. Any suggestions will be greatly appreciated! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I remove multiple 'errors' in Excel error checking, at the same time??? | Excel Discussion (Misc queries) | |||
Spell Checking with checking cell notes | Excel Discussion (Misc queries) | |||
Excel Throwing Circular Errors When No Errors Exist | Excel Worksheet Functions | |||
Checking excel for errors/inconsistencies | Excel Worksheet Functions | |||
Unresolved Errors in IF Statements - Errors do not show in results | Excel Worksheet Functions |