Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
if then else problem
Hi,
can anybody tell me what is wrong in this snippet of code ? If search_acc.Value < " " Then result = search_acc.Value Column = 23 ElseIf search_status < " " Then result = search_status.Value Column = 176 Else: GoTo nochoice End If ..... various code ..... nochoice: msgbox "you did not make a choice, make a choice !" Where search_acc and search_status are comboboxes Whatever you do, you allways end up with the messagebox from nochoice: Please help ! Thanks, Pierre |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
if then else problem
Try using "" instead of " ".
-- Dan On Dec 20, 12:44 pm, "Pierre" wrote: Hi, can anybody tell me what is wrong in this snippet of code ? If search_acc.Value < " " Then result = search_acc.Value Column = 23 ElseIf search_status < " " Then result = search_status.Value Column = 176 Else: GoTo nochoice End If .... various code .... nochoice: msgbox "you did not make a choice, make a choice !" Where search_acc and search_status are comboboxes Whatever you do, you allways end up with the messagebox from nochoice: Please help ! Thanks, Pierre |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
if then else problem
Should This:
If search_acc.Value < " " Then be this: If search_acc.Value < "" Then Unless you deliberately put the space between the double quotes for clarity in this posting, it probably would not work well in your code unless you have single spaces entered in your combobox. If you are testing for null then, there should be no space between the quote marks. Also, it is not good practice to use reserved names like Column for variables. That can produce undesirable results too. "Pierre" wrote: Hi, can anybody tell me what is wrong in this snippet of code ? If search_acc.Value < " " Then result = search_acc.Value Column = 23 ElseIf search_status < " " Then result = search_status.Value Column = 176 Else: GoTo nochoice End If ..... various code ..... nochoice: msgbox "you did not make a choice, make a choice !" Where search_acc and search_status are comboboxes Whatever you do, you allways end up with the messagebox from nochoice: Please help ! Thanks, Pierre |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
if then else problem
What line of code do you have on the line immediately above the line label
"nochoice:"? You should have an Exit Sub or something to make sure you jump around the MsgBox. (I'm assuming that the MsgBox after "nochoice:" is right at the end of the routine, like an error handler.) -- Regards, Bill Renaud |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
if then else problem
You also have the following line:
Else: GoTo nochoice There should not be a colon (:) after the Else. -- Regards, Bill Renaud |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
if then else problem
Hi Bill,
stupid of me, it was indead the : (colon) thanks for your help, Pierre "Bill Renaud" schreef in bericht . .. You also have the following line: Else: GoTo nochoice There should not be a colon (:) after the Else. -- Regards, Bill Renaud |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Colon at the end of excel file name(ex: problem.xls:1, problem.xls | New Users to Excel | |||
Started out as an Access problem. Now an Excel problem | Excel Discussion (Misc queries) | |||
problem with a conditional max problem | Excel Discussion (Misc queries) | |||
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? | Excel Programming |