View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Failing to capture values correctly? - CORRECTION

I am having trouble understanding your Select Case statement. How does the
True criteria translate to the lCostScore Case? It would make more sense if
It read:

Select Case lCostScore
Case 1
'Do stuff
Case 2
'Do other stuff

Etc.

"Risky Dave" wrote:

Ooops!

Apologies, the the actual codeis this. The error is the same:

Sub BAUCostCheck()
Dim lCostScore As Long ' used to capture the assessed cost score
Dim lCostEst As Long ' used to capture the estimated cost

lCostScore = CLng(FmRiskCost.TextBox16.Value)
lCostEst = CLng(FmRiskCost.TextBox17.Value)

Select Case True
Case lCostScore = "1"
<do stuff
Case lCostScore = "2"
<do stuff
Case lCostScore = "3"
If lCostEst < 50000 or lCostEst 100000 Then
MsgBox "Medium cost must be between £50,000 and £100,000",
vbExclamation, "Cost Estimation Error"
FmRiskCost.TextBox19.Value = ""
FmRiskCost.TextBox22.Value = ""
FmRiskCost.TextBox24.Value = ""
FmRiskCost.TextBox25.Value = ""
FmRiskCost.TextBox26.Value = ""
End If
Case lCostScore ="4"
.
.
.
End Select
End Sub


"Risky Dave" wrote:


<snip
TIA

Dave