Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date Format for Userform TextBox John Calder New Users to Excel 4 July 29th 09 10:19 PM
TextBox on a userform - format to currency & percent Terry Excel Discussion (Misc queries) 2 September 12th 08 02:46 PM
how do i format a textbox on a userform created in excel Bert New Users to Excel 1 May 5th 08 11:46 PM
Need A date Mask format for a Textbox on UserForm [email protected] Excel Discussion (Misc queries) 2 November 4th 07 02:27 AM
Userform Textbox Currency Format Problems Dunce in SC Excel Programming 2 October 27th 03 12:45 AM


All times are GMT +1. The time now is 06:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"