Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format of textbox on userform and correct result
I amusing Excel 97.
I am trying without much look to calculate the VAT and have used the following. txtVAT1.Value = Format((Val(txtT1.Value) + Val (txtNT1.Value)) * (Val(txtT1.Value) + Val (txtNT1.Value)) / 17.5, "£##.00") Firstly, when I use the above formula and say the value of txtT1 is £9 and the value of txtNT1 is £1 the sum is £10 and the VAT amount is correctly calulated to £1.75. However if I changes to values to £90 & £10 respectively then the result of the VAT is £175!! Secondly, how do you force the txtbox to only 2 decimal places I have tried the above and it's very hit and miss. The whole problem is obviously to do with decimal spaces but I'm stuck any takers? Regards Mark |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format of textbox on userform and correct result
Hi Mark
Is this what you want: Sub egFormat() x = 1.234567 * 12345.678 y = Format(x, "£#,##0.00") MsgBox y & vbCr & vbCr & x End Sub Regards, Peter -----Original Message----- I amusing Excel 97. I am trying without much look to calculate the VAT and have used the following. txtVAT1.Value = Format((Val(txtT1.Value) + Val (txtNT1.Value)) * (Val(txtT1.Value) + Val (txtNT1.Value)) / 17.5, "£##.00") Firstly, when I use the above formula and say the value of txtT1 is £9 and the value of txtNT1 is £1 the sum is £10 and the VAT amount is correctly calulated to £1.75. However if I changes to values to £90 & £10 respectively then the result of the VAT is £175!! Secondly, how do you force the txtbox to only 2 decimal places I have tried the above and it's very hit and miss. The whole problem is obviously to do with decimal spaces but I'm stuck any takers? Regards Mark . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Date Format for Userform TextBox | New Users to Excel | |||
TextBox on a userform - format to currency & percent | Excel Discussion (Misc queries) | |||
how do i format a textbox on a userform created in excel | New Users to Excel | |||
Need A date Mask format for a Textbox on UserForm | Excel Discussion (Misc queries) | |||
Userform Textbox Currency Format Problems | Excel Programming |