LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default checking for errors in combobox's

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I remove multiple 'errors' in Excel error checking, at the same time??? [email protected] Excel Discussion (Misc queries) 2 May 11th 23 11:42 AM
Spell Checking with checking cell notes jfitzpat Excel Discussion (Misc queries) 0 August 8th 07 10:26 PM
Excel Throwing Circular Errors When No Errors Exist MDW Excel Worksheet Functions 1 August 10th 06 02:15 PM
Checking excel for errors/inconsistencies markx Excel Worksheet Functions 1 February 23rd 05 03:13 PM
Unresolved Errors in IF Statements - Errors do not show in results Markthepain Excel Worksheet Functions 2 December 3rd 04 08:49 AM


All times are GMT +1. The time now is 07:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"