Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Adding vs Concatenate

Private Sub CmbBxOpening_Change()
TxtBxWTOpening = Format(CmbBxOpening.Value / 3 * 5, "0.00")
Tscore1.Value = Val(TxtBxWTOpening.Value) + Val(TxbBxWTPolicy.Value)
End Sub

Private Sub CmbBxPolicy_Change()
TxtBxWTPolicy = Format(CmbBxPolicy.Value / 1 * 8, "0.00")
Tscore1.Value = Val(TxtBxWTOpening.Value) + Val(TxbBxWTPolicy.Value)
End Sub


In the Tscore1 textbox, I am getting a concatenation of what is
entered in TxtBxWTOpening and TxtBxWTPolicy.

When I select 1 in the CmbBxOpening combo box, I get 1.67 in
TxtBxWTOpening
When I select 1 in the CmbBxPolicy combo box, I get 8.00 in
TxtBxWTPolicy

when I add them, instead of getting 9.67, i am getting 1.678.00 which
is a concatenation. Can anyone help?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Adding vs Concatenate

The combobox store the number as text instead of numbers. If you are reading
the values from the combo box you must convert the text to numbers before you
add them. Simply do what you have already done in tthe code posted. Use the
Val function. total = val(Combobox1.text) + val(Combobox2.text)

"Maxi" wrote:

Private Sub CmbBxOpening_Change()
TxtBxWTOpening = Format(CmbBxOpening.Value / 3 * 5, "0.00")
Tscore1.Value = Val(TxtBxWTOpening.Value) + Val(TxbBxWTPolicy.Value)
End Sub

Private Sub CmbBxPolicy_Change()
TxtBxWTPolicy = Format(CmbBxPolicy.Value / 1 * 8, "0.00")
Tscore1.Value = Val(TxtBxWTOpening.Value) + Val(TxbBxWTPolicy.Value)
End Sub


In the Tscore1 textbox, I am getting a concatenation of what is
entered in TxtBxWTOpening and TxtBxWTPolicy.

When I select 1 in the CmbBxOpening combo box, I get 1.67 in
TxtBxWTOpening
When I select 1 in the CmbBxPolicy combo box, I get 8.00 in
TxtBxWTPolicy

when I add them, instead of getting 9.67, i am getting 1.678.00 which
is a concatenation. Can anyone help?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Adding vs Concatenate

thank you so much for your help

On Aug 30, 4:08 pm, Joel wrote:
The combobox store the number as text instead of numbers. If you are reading
the values from the combo box you must convert the text to numbers before you
add them. Simply do what you have already done in tthe code posted. Use the
Val function. total = val(Combobox1.text) + val(Combobox2.text)



"Maxi" wrote:
Private Sub CmbBxOpening_Change()
TxtBxWTOpening = Format(CmbBxOpening.Value / 3 * 5, "0.00")
Tscore1.Value = Val(TxtBxWTOpening.Value) + Val(TxbBxWTPolicy.Value)
End Sub


Private Sub CmbBxPolicy_Change()
TxtBxWTPolicy = Format(CmbBxPolicy.Value / 1 * 8, "0.00")
Tscore1.Value = Val(TxtBxWTOpening.Value) + Val(TxbBxWTPolicy.Value)
End Sub


In the Tscore1 textbox, I am getting a concatenation of what is
entered in TxtBxWTOpening and TxtBxWTPolicy.


When I select 1 in the CmbBxOpening combo box, I get 1.67 in
TxtBxWTOpening
When I select 1 in the CmbBxPolicy combo box, I get 8.00 in
TxtBxWTPolicy


when I add them, instead of getting 9.67, i am getting 1.678.00 which
is a concatenation. Can anyone help?- Hide quoted text -


- Show quoted text -



Reply
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
concatenate #N/A Bry Excel Discussion (Misc queries) 7 April 29th 23 03:42 AM
How to concatenate D1:D64? Joe User[_2_] Excel Discussion (Misc queries) 2 February 8th 10 10:31 AM
Concatenate function adding double quotes to both ends of results SqtYork Excel Worksheet Functions 0 September 4th 07 06:22 PM
CONCATENATE Tennisstar007 Excel Worksheet Functions 9 March 7th 06 03:31 PM
I know how to concatenate ,can one de-concatenate to split date? QUICK BOOKS PROBLEM- New Users to Excel 1 July 26th 05 05:07 PM


All times are GMT +1. The time now is 10:21 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"