SUM in Userform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Experts
Using Excel 2003

What is the right way to SUM 2 TextBoxes ?

I got a Userfom with 3 Textboxes:

TboxBread ( value is 5.50 )
TboxButter ( value is 4.50 )
TboxSUM ( value has to be 10.00 )

Why the h... isent there a Valuebox to use instead of Textbox ?

any help is velcome.
 
Try using the Val function for the values in your text boxes, as in this
snippet:

Private Sub CommandButton1_Click()
Dim My1, My2, My3
My1 = Val(UserForm1.TextBox1.Value)
My2 = Val(UserForm1.TextBox2.Value)
My3 = My1 + My2
UserForm1.TextBox3.Value = My3
End Sub

Hope this helps.

Keith
 
ok that would do the trick :-)

thanks both Keithlo and Tom


"Tom Ogilvy" skrev:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top