ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need Text box value to be $5,000.00 not 5000 (https://www.excelbanter.com/excel-programming/403343-need-text-box-value-%245-000-00-not-5000-a.html)

Jason V[_2_]

Need Text box value to be $5,000.00 not 5000
 
I have the following code
Sub CalcPrice()

Dim TotalPrice As Currency
Set xls = Excel.Worksheets("ProjectDB")
Sheets("ProjectDB").Select

Col = 11
For row = 141 To 160
Price = xls.Cells(row, Col)
TotalPrice = TotalPrice + Price
Next row
QuoteForm.TBPricing.Value = TotalPrice
End Sub
I want the sum of these cell displayed as currency and not just a number
Please help. Thank You
--
Jason V

Jon Peltier

Need Text box value to be $5,000.00 not 5000
 
QuoteForm.TBPricing.Value = Format(TotalPrice,"$#,##0.00")

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Jason V" wrote in message
...
I have the following code
Sub CalcPrice()

Dim TotalPrice As Currency
Set xls = Excel.Worksheets("ProjectDB")
Sheets("ProjectDB").Select

Col = 11
For row = 141 To 160
Price = xls.Cells(row, Col)
TotalPrice = TotalPrice + Price
Next row
QuoteForm.TBPricing.Value = TotalPrice
End Sub
I want the sum of these cell displayed as currency and not just a number
Please help. Thank You
--
Jason V




Per Jessen[_2_]

Need Text box value to be $5,000.00 not 5000
 
On 28 Dec., 18:41, Jason V wrote:
I have the following code
Sub CalcPrice()

Dim TotalPrice As Currency
Set xls = Excel.Worksheets("ProjectDB")
Sheets("ProjectDB").Select

Col = 11
For row = 141 To 160
* * Price = xls.Cells(row, Col)
* * TotalPrice = TotalPrice + Price
Next row
QuoteForm.TBPricing.Value = TotalPrice
End Sub
I want the sum of these cell displayed as currency and not just a number
Please help. Thank You
--
Jason V


Hi Jason

QuoteForm.TBPricing.Value = FormatCurrency(TotalPrice)

Regards,

Per

Jason V[_2_]

Need Text box value to be $5,000.00 not 5000
 
Thank You. It works.
--
Jason V


"Per Jessen" wrote:

On 28 Dec., 18:41, Jason V wrote:
I have the following code
Sub CalcPrice()

Dim TotalPrice As Currency
Set xls = Excel.Worksheets("ProjectDB")
Sheets("ProjectDB").Select

Col = 11
For row = 141 To 160
Price = xls.Cells(row, Col)
TotalPrice = TotalPrice + Price
Next row
QuoteForm.TBPricing.Value = TotalPrice
End Sub
I want the sum of these cell displayed as currency and not just a number
Please help. Thank You
--
Jason V


Hi Jason

QuoteForm.TBPricing.Value = FormatCurrency(TotalPrice)

Regards,

Per



All times are GMT +1. The time now is 03:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com