![]() |
Formating currency in text box
This is the code I got yesterday, but I'm still having
problems. Private Sub txtHouseCost_AfterUpdate() txtHouseCost.Value = Format(CInt(txtHouseCost.Value), "# ##0 $") End Sub When I enter a number it rounds up or down, I lose the digits after the decimal, and the $ is at the left end of the number. The other problem I have is if I move the $ to the front, $# ##0 , the total doen't work. I'm using Total = Val(txtHouseCost.Value) + Val(txtLotCost.Value) + Val(txtOptionCost.Value) Any ideas to help this old struggling newbie? |
Formating currency in text box
Doug
Doug wrote: This is the code I got yesterday, but I'm still having problems. Private Sub txtHouseCost_AfterUpdate() txtHouseCost.Value = Format(CInt(txtHouseCost.Value), "# ##0 $") =Format(txtHouseCost.Text, "$#,##0.00") End Sub When I enter a number it rounds up or down, I lose the digits after the decimal, and the $ is at the left end of the number. The other problem I have is if I move the $ to the front, $# ##0 , the total doen't work. I'm using Total = Val(txtHouseCost.Value) + Val(txtLotCost.Value) + Val(txtOptionCost.Value) Total = CDbl(txtHouseCost.Text) + CDbl(txtLotCost.Text) etc... -- Dick Kusleika Excel MVP Daily Dose of Excel www.dicks-blog.com |
All times are GMT +1. The time now is 01:21 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com