Is is possible? and how?

G

Guest

I have a comboBox from toolbar. And in it i have list of items through the
ListFillRange.

The Combo Box looks as such:

Apple- Red
Apple-Green
Apple-Yellow
Watermelon
Orange
Banana

My question is: Is it possible to make a statement
where i say something like: [[" If ComboBox.Value="Apple" Then......]]

Note that as a Value I have only the word "Apple" and Im not specifying the
color.
I would like to make VB understand that the if statement applies to all
apples even if I dont specify the color like it shows in the combobox. I
could make an If statment for each apple but that would be alot of If's. I
have over 30 Apples! different colors
 
P

Pete_UK

Have a look at the LEFT function - it enables you to compare the
leftmost characters (5 in your case).

Hope this helps.

Pete
 
G

Guest

try:

Private Sub ComboBox1_Change()
If InStr(1, ComboBox1.Value, "Apple") Then
MsgBox "Apple selected"
End If
End Sub
 
G

Guest

Thank you !!

Always appreciate the help you all provide

Toppers said:
try:

Private Sub ComboBox1_Change()
If InStr(1, ComboBox1.Value, "Apple") Then
MsgBox "Apple selected"
End If
End Sub

M&M said:
I have a comboBox from toolbar. And in it i have list of items through the
ListFillRange.

The Combo Box looks as such:

Apple- Red
Apple-Green
Apple-Yellow
Watermelon
Orange
Banana

My question is: Is it possible to make a statement
where i say something like: [[" If ComboBox.Value="Apple" Then......]]

Note that as a Value I have only the word "Apple" and Im not specifying the
color.
I would like to make VB understand that the if statement applies to all
apples even if I dont specify the color like it shows in the combobox. I
could make an If statment for each apple but that would be alot of If's. I
have over 30 Apples! different colors
 

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