Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try
If IsNumeric(Me.FmRiskCost.TextBox9.Value) _ And IsNumeric(Me.FmRiskCost.TextBox10.Value) _ And IsNumeric(Me.FmRiskCost.TextBox11.Value) _ And IsNumeric(Me.FmRiskCost.TextBox12.Value) _ And IsNumeric(Me.FmRiskCost.TextBox13.Value) Then Me.dMitCost.value = (CDbl(FmRiskCost.TextBox9.Value) + CDbl_(FmRiskCost.TextBox10.Value) + CDbl(FmRiskCost.TextBox11.Value) + CDbl_(FmRiskCost.TextBox12.Value) + CDbl(FmRiskCost.TextBox13.Value))_ Me.FmRiskCost.TextBox23.Value = Me.dMitCost.Value End "Risky Dave" wrote: Hi, Can someone please tell me why this does not work (it throws up a type mismatch): Sub Cost_Update() Dim dMitCost As Double dMitCost = (CDbl(FmRiskCost.TextBox9.Value) + CDbl_(FmRiskCost.TextBox10.Value) + CDbl(FmRiskCost.TextBox11.Value) + CDbl_(FmRiskCost.TextBox12.Value) + CDbl(FmRiskCost.TextBox13.Value))_ FmRiskCost.TextBox23.Value = dMitCost End I am trying to capture (up to) five values entered into textboxes on a form, add them and then send the total value to another text box on the same form. I can do this by replacing the CDbl with a Val, but the calculation then goes haywire when lage numbers are inputted. Is this a variation on the old thing of XL assuming that anything joined by a '+' sign is a string not a number? If so, how do I get around it? Hope this makes some sense! TIA Dave |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
confused | Excel Worksheet Functions | |||
I'm Confused........................................ | Excel Programming | |||
Sorry I am confused | Excel Discussion (Misc queries) | |||
dim a String A="2+3+5" A=cdbl(A)??? | Excel Programming | |||
CDbl function | Excel Programming |