Is is possible? and how?

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Have a look at the LEFT function - it enables you to compare the
leftmost characters (5 in your case).

Hope this helps.

Pete
 
try:

Private Sub ComboBox1_Change()
If InStr(1, ComboBox1.Value, "Apple") Then
MsgBox "Apple selected"
End If
End Sub
 
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
 
Back
Top