LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default Failing to capture values correctly?

Hi,

Can someone please explain why this isn't working? I am trying to capture
two values entered into a form by a user - Cost Score and Cost Estimate. Cost
Score is a value of 1 - 5 and Cost Estimate is a value in £'s. Each of the 5
possible Cost Scores has a range of Cost Estimates that is valid for it and
this code is trying to check that an appropriate Estimate has been made
against the declared Score. If an appropriate Estimate has not been made, an
error message is returned.

When this runs with legitimate values entered in TextBoxes 16 and 17, it
still returns the error message and I don't understand why so any
observations would be much appreciated.

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 and 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"
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel screen capture to capture cells and row and column headings jayray Excel Discussion (Misc queries) 5 November 2nd 07 11:01 PM
capture unique values and calculate bcamp1973 Excel Discussion (Misc queries) 4 May 15th 06 06:06 PM
'IF' FORMULA TO CAPTURE CERTAIN CELL VALUES PaulH-Oz Excel Worksheet Functions 1 March 27th 06 01:25 AM
'IF' FORMULA TO CAPTURE CERTAIN CELL VALUES Franksta Excel Worksheet Functions 0 March 26th 06 11:57 PM
'IF' FORMULA TO CAPTURE CERTAIN CELL VALUES JMB Excel Worksheet Functions 0 March 26th 06 11:47 PM


All times are GMT +1. The time now is 04:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"