![]() |
Is is possible? and how?
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 |
Is is possible? and how?
Have a look at the LEFT function - it enables you to compare the
leftmost characters (5 in your case). Hope this helps. Pete On Aug 1, 8:10 pm, M&M wrote: 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 |
Is is possible? and how?
try:
Private Sub ComboBox1_Change() If InStr(1, ComboBox1.Value, "Apple") Then MsgBox "Apple selected" End If End Sub "M&M" wrote: 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 |
Is is possible? and how?
Thank you !! Always appreciate the help you all provide "Toppers" wrote: try: Private Sub ComboBox1_Change() If InStr(1, ComboBox1.Value, "Apple") Then MsgBox "Apple selected" End If End Sub "M&M" wrote: 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 |
All times are GMT +1. The time now is 08:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com