If Then statement

A

Adam

This is probably very simple.
I have a ComboBox with 10 choises. Is it possible to get theese
multipel choises down to a one line if statement. Something like this
(but working) :

If ComboBox1 = Choise1 or Choise2 of Choise3 Then
code
Else
code
End If

Cheers

Adam
 
J

Jonathan West

Adam said:
This is probably very simple.
I have a ComboBox with 10 choises. Is it possible to get theese
multipel choises down to a one line if statement. Something like this
(but working) :

If ComboBox1 = Choise1 or Choise2 of Choise3 Then
code
Else
code
End If


Select Case ComboBox1.ListIndex
Case Choice1, Choice2, Choice3
'code
Case Else
'code
End Select

Choice1, Choice2 and Choice3 should be the positions of the various items on
the list - the first item is indexed as zero. If you want to use the text
instead, then use ComboBox1.Text instead of ComboBox1.ListIndex and make the
choices strings.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top