![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Location: Baltimore
Posts: 29
|
Here is the code:
With Sheets("Order Table").Range("B" & intcurrentrow) If lstOrderType = "Delivery" Then .Value = "Delivery" ElseIf lstOrderType = "Carry-Out" Then .Value = "Carry-Out" Else .Value = "Eat-In" End If End With The only value i get in the range is Eat-In. |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Apr 2002
Posts: 112
|
I tried your code and it worked for me. Are you sure you are passing the right variable names (spelled correctly, right number of spaces...)?
|
|
|
|
|
|
#3 |
|
New Member
Join Date: May 2002
Location: Baltimore
Posts: 29
|
Yes, here is my updated code, still getting "Eat-In" for value in range.
With Sheets("Order Table").Range("B" & intcurrentrow) If cboOrderType = "Delivery" Then .Value = "Delivery" ElseIf cboOrderType = "Carry-Out" Then .Value = "Carry-Out" Else .Value = "Eat-In" End If End With |
|
|
|
|
|
#4 | |
|
Board Regular
Join Date: Apr 2002
Posts: 112
|
Quote:
|
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Apr 2002
Posts: 112
|
I noticed in your code that cboOrderType could equal any value besides "Dinner" and Carry-Out" and it would place "Eat-In" in the range. It never checks to see what happens if it says something else. Try this replacement code:
With Sheets("Order Table").Range("B" & intcurrentrow) If lstOrderType = "Delivery" Then .Value = "Delivery" ElseIf lstOrderType = "Carry-Out" Then .Value = "Carry-Out" ElseIf lstOrderType = "Eat-In" Then .Value = "Eat-In" Else .Value = "Incorrect Value" End If End With |
|
|
|
|
|
#6 |
|
New Member
Join Date: May 2002
Location: Baltimore
Posts: 29
|
Now it comes up with "Incorrect Value", so its skipping through all the other if's, and going straight to the last one. I can't figure it out. I can send u the file if you want to look at it first hand.
|
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Apr 2002
Posts: 112
|
Why don't you place a watch on cboOrderType and place a breakpoint at the first 'IF' statement. It will show you what value is assigned to "cboOrderType". I really believe this is the problem. "cboOrderType" is not the value you think it is. It might be something simple as an extra space.
|
|
|
|
|
|
#8 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
It may not be incorrect in the file that's one the way...Should be careful how many people you get cracking on this at one time, it's not considerate to have 30 people all reinventing the wheel at once.
_________________ Cheers, NateO ![]() [ This Message was edited by: NateO on 2002-05-07 12:11 ] |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|