M
Marcotte A
I'm using an InputBox to get info from the user. I am getting 5 numbers and strings associated with a product. Some of the numbers can be zero. I would like to have the user be able to hit cancel anytime before entering in the 5th variable to cancel the whole operation. IE, put the old info back in and prompt the user to select a new product. This works fine unless they enter 0 for a number. Here is a snippet of the code: (note: the variables are Variants so that I can test for a FALSE return from InputBox. Seperate question: could my number variables be singles instead?) TI
'This is inside a larger Do..Loop that covers entering all five variables. All five variables have loops like this below to test the input from the user
D
vOldCost = .Cells(RowNum, 16).Value 'Capture the old Cost dat
vCost = Application.InputBox(prompt:="Enter material cost.",
Type:=1
If vCost = False Then 'problem is here...user enters in 0 for cost and the If gets executed
CancelProdInput vOldProduct, vOldCost,
vOldType, vOldTime, vOldPrice, RowNum ' CancelProdInput puts the 'Old' data back in the correct cell
GoTo LoopBegin 'go back to beginning....ask user to select product
End I
.Cells(RowNum, 16) = vCos
Loop Until vCost >= 0
'This is inside a larger Do..Loop that covers entering all five variables. All five variables have loops like this below to test the input from the user
D
vOldCost = .Cells(RowNum, 16).Value 'Capture the old Cost dat
vCost = Application.InputBox(prompt:="Enter material cost.",
Type:=1
If vCost = False Then 'problem is here...user enters in 0 for cost and the If gets executed
CancelProdInput vOldProduct, vOldCost,
vOldType, vOldTime, vOldPrice, RowNum ' CancelProdInput puts the 'Old' data back in the correct cell
GoTo LoopBegin 'go back to beginning....ask user to select product
End I
.Cells(RowNum, 16) = vCos
Loop Until vCost >= 0