Two decimals

  • Thread starter Trine Andreassen
  • Start date
T

Trine Andreassen

Can anyone pls help me... How do I get two decimals behind the input
and output number in the textboxed in my coding in VBA in th most easy
way possible....? Have tried the Format "0.00" as someone suggested on
the website here, but it did not work and I am not sure I am placing
it in the right spot...

Any suggestions would me welcome!

Thanks
Trine
 
I

Incidental

Hi Trine

I'm not sure what you are trying to do exactly but the code below
might help you with your problem. I set up a userform with two
textboxes and a button to control the code, if a whole number is added
to the first textbox when you click the button it will convert the
number in textbox1 to a double and also add the number as a double in
the second textbox.

Option Explicit

Dim MyNum As Double

Private Sub CommandButton1_Click()

MyNum = TextBox1.Value

TextBox2.Value = Format(MyNum, "0.00")

TextBox1.Value = Format(MyNum, "0.00")

End Sub

I hope this is of some help to you

Steve
 

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

Top