Make Summation in Userform

hmk

Active Member
Joined
Jun 8, 2004
Messages
423
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 ?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hesham

vtt is a variable, so doesn't have any properties like Value etc.
 
Upvote 0
i mage 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
 
Upvote 0
tooo is also a variable, therefore doesn't have propertyies like Value.
 
Upvote 0

Forum statistics

Threads
1,203,081
Messages
6,053,416
Members
444,662
Latest member
AaronPMH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top