Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi there i use userform to sum the entered numbers into the same userform Code: -------------------- Private Sub CommandButton1_Click() If Label1.Caption = "" Then Label1.Caption = TextBox1.Value TextBox2.Value = TextBox1.Value Else: Label1.Caption = Label1.Caption & vbCr Label1.Caption = Label1.Caption & TextBox1.Value TextBox2.Value = TextBox2.Value + TextBox1.Value End If TextBox1.Value = "" End Sub -------------------- but this line: Code: -------------------- TextBox2.Value = TextBox2.Value + TextBox1.Value -------------------- put the numeric values next to each other i need to sum them insted ? -- helmekki ------------------------------------------------------------------------ helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939 View this thread: http://www.excelforum.com/showthread...hreadid=486630 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Helmekki,
but this line: Code: -------------------- TextBox2.Value = TextBox2.Value + TextBox1.Value -------------------- put the numeric values next to each other i need to sum them insted ? Try: TextBox2.Value = CDbl(TextBox2.Value) + CDbl(TextBox1.Value) --- Regards, Norman "helmekki" wrote in message ... Hi there i use userform to sum the entered numbers into the same userform Code: -------------------- Private Sub CommandButton1_Click() If Label1.Caption = "" Then Label1.Caption = TextBox1.Value TextBox2.Value = TextBox1.Value Else: Label1.Caption = Label1.Caption & vbCr Label1.Caption = Label1.Caption & TextBox1.Value TextBox2.Value = TextBox2.Value + TextBox1.Value End If TextBox1.Value = "" End Sub -------------------- but this line: Code: -------------------- TextBox2.Value = TextBox2.Value + TextBox1.Value -------------------- put the numeric values next to each other i need to sum them insted ? -- helmekki ------------------------------------------------------------------------ helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939 View this thread: http://www.excelforum.com/showthread...hreadid=486630 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() i tried with this code: Code: -------------------- Private Sub CommandButton1_Click() Dim tooo As Double Dim vtt As Double If Label1.Caption = "" Then Label1.Caption = vtt.Value tooo.Value = vtt.Value Else: Label1.Caption = Label1.Caption & vbCr Label1.Caption = Label1.Caption & vtt tooo.Value = CDbl(tooo) + CDbl(vtt) End If tooo.Value = "" End Sub -------------------- but it gives me invaled qualifier when tring to read vtt any idea how to solve the problem ? -- helmekki ------------------------------------------------------------------------ helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939 View this thread: http://www.excelforum.com/showthread...hreadid=486630 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Since vtt is an intrinsic data type (a double), it doesn't have
any properties. Your code tooo.Value = vtt.Value is wrong. It should be tooo = vtt The code tooo.Value = CDbl(tooo) + CDbl(vtt) is also wrong. First, you can't have a Value property, and since tooo and vtt are declared as double, you don't need the CDbl function at all. tooo= tooo + vtt -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "helmekki" wrote in message ... i tried with this code: Code: -------------------- Private Sub CommandButton1_Click() Dim tooo As Double Dim vtt As Double If Label1.Caption = "" Then Label1.Caption = vtt.Value tooo.Value = vtt.Value Else: Label1.Caption = Label1.Caption & vbCr Label1.Caption = Label1.Caption & vtt tooo.Value = CDbl(tooo) + CDbl(vtt) End If tooo.Value = "" End Sub -------------------- but it gives me invaled qualifier when tring to read vtt any idea how to solve the problem ? -- helmekki ------------------------------------------------------------------------ helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939 View this thread: http://www.excelforum.com/showthread...hreadid=486630 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I made some correction, but still got type mismatch in the line CDbl(tooo.Value) here is the whole code Code: -------------------- Private Sub CommandButton1_Click() Dim cdbltooo As Double Dim cdbltotv As Double If Label1.Caption = "" Then Label1.Caption = totv.Value tooo.Value = CDbl(totv.Value) Else: Label1.Caption = Label1.Caption & vbCr Label1.Caption = Label1.Caption & totv.Value tooo.Value = CDbl(tooo.Value) + CDbl(totv) End If tooo.Value = "" End Sub -------------------- -- helmekki ------------------------------------------------------------------------ helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939 View this thread: http://www.excelforum.com/showthread...hreadid=486630 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Did you read my reply? You still have .Value on your totv and
tooo variables. This WILL NOT WORK. Get rid of the .Value's. And you don't need the CDbl functions because your variables are already doubles. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "helmekki" wrote in message ... I made some correction, but still got type mismatch in the line CDbl(tooo.Value) here is the whole code Code: -------------------- Private Sub CommandButton1_Click() Dim cdbltooo As Double Dim cdbltotv As Double If Label1.Caption = "" Then Label1.Caption = totv.Value tooo.Value = CDbl(totv.Value) Else: Label1.Caption = Label1.Caption & vbCr Label1.Caption = Label1.Caption & totv.Value tooo.Value = CDbl(tooo.Value) + CDbl(totv) End If tooo.Value = "" End Sub -------------------- -- helmekki ------------------------------------------------------------------------ helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939 View this thread: http://www.excelforum.com/showthread...hreadid=486630 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Ok , i did what you said, but it did not work with me . still tooo TextBox does not show the total amount entered in vtt each time i enter a new number............. i need the tooo to show the total of numbers entered into vtt each time here is the code and please find the attached file Code: -------------------- Private Sub CommandButton1_Click() Dim tooo As Double Dim vtt As Double If Label1.Caption = "" Then Label1.Caption = vtt tooo = vtt Else: Label1.Caption = Label1.Caption & vbCr Label1.Caption = Label1.Caption & vtt tooo = tooo + vtt End If tooo = "" End Sub -------------------- -- helmekki ------------------------------------------------------------------------ helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939 View this thread: http://www.excelforum.com/showthread...hreadid=486630 |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your last command is
tooo = "" so it you clear whatever it may have shown from the earlier code. Also, don't dimension tooo as Double if it is a textbox. Don't dimension it at all. Assuming tooo and vtt are textboxes on your form Private Sub CommandButton1_Click() If Label1.Caption = "" Then Label1.Caption = vtt tooo.Value = vtt.Value Else: Label1.Caption = Label1.Caption & vbCr Label1.Caption = Label1.Caption & vtt tooo.Value = val(tooo.value) + val(vtt.Value) End If End Sub -- Regards, Tom Ogilvy "helmekki" wrote in message ... Ok , i did what you said, but it did not work with me . still tooo TextBox does not show the total amount entered in vtt each time i enter a new number............. i need the tooo to show the total of numbers entered into vtt each time here is the code and please find the attached file Code: -------------------- Private Sub CommandButton1_Click() Dim tooo As Double Dim vtt As Double If Label1.Caption = "" Then Label1.Caption = vtt tooo = vtt Else: Label1.Caption = Label1.Caption & vbCr Label1.Caption = Label1.Caption & vtt tooo = tooo + vtt End If tooo = "" End Sub -------------------- -- helmekki ------------------------------------------------------------------------ helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939 View this thread: http://www.excelforum.com/showthread...hreadid=486630 |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Tom Ogilvy, realy thank u veru much it worked great for me -- helmekki ------------------------------------------------------------------------ helmekki's Profile: http://www.excelforum.com/member.php...fo&userid=6939 View this thread: http://www.excelforum.com/showthread...hreadid=486630 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Looping procedure calls userform; how to exit loop (via userform button)? | Excel Programming | |||
Max numbers of characters in userform textbox and cell | Excel Programming | |||
Activating userform and filling it with data form row where userform is activate | Excel Programming | |||
Access from add_in userform to main template userform.... | Excel Programming | |||
add numbers in textboxes on userform | Excel Programming |