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 Confused by CDbl behaviour

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
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
confused mdj0615 Excel Worksheet Functions 1 July 30th 09 03:33 AM
I'm Confused........................................ Jonathan Excel Programming 8 May 4th 05 12:37 PM
Sorry I am confused Desmond Excel Discussion (Misc queries) 7 April 24th 05 10:40 PM
dim a String A="2+3+5" A=cdbl(A)??? Andoni[_51_] Excel Programming 5 September 17th 04 02:37 AM
CDbl function snax500[_2_] Excel Programming 4 October 22nd 03 04:32 PM


All times are GMT +1. The time now is 10:29 AM.

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"