ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Display Value in 'Currency Format' (https://www.excelbanter.com/excel-programming/364277-display-value-currency-format.html)

mpeplow[_3_]

Display Value in 'Currency Format'
 

How can I make frmstat.lblCOH.caption display Capital_on_Hold with $ and
, instead of just the raw number?

Dim Capital_on_Hold As Currency

'Find the last row of data on CORE ON-HOLD sheet
Finalrow =
Sheets(frmBrain.txtCoreonhold.Text).Range("A65536" ).End(xlUp).Row
Capital_on_Hold = 0

For x = 2 To Finalrow
Capital_on_Hold = Capital_on_Hold +
Val(Trim(Sheets(frmBrain.txtCoreonhold.Text).Range ("N" & x).Formula))
Next x
frmStats.lblCOH.Caption = Capital_on_Hold

frmStats.Show


--
mpeplow
------------------------------------------------------------------------
mpeplow's Profile: http://www.excelforum.com/member.php...o&userid=34812
View this thread: http://www.excelforum.com/showthread...hreadid=551944


Bernie Deitrick

Display Value in 'Currency Format'
 

frmStats.lblCOH.Caption = Format(Capital_on_Hold, "$#,##0.00")

HTH,
Bernie
MS Excel MVP


"mpeplow" wrote in message
...

How can I make frmstat.lblCOH.caption display Capital_on_Hold with $ and
, instead of just the raw number?

Dim Capital_on_Hold As Currency

'Find the last row of data on CORE ON-HOLD sheet
Finalrow =
Sheets(frmBrain.txtCoreonhold.Text).Range("A65536" ).End(xlUp).Row
Capital_on_Hold = 0

For x = 2 To Finalrow
Capital_on_Hold = Capital_on_Hold +
Val(Trim(Sheets(frmBrain.txtCoreonhold.Text).Range ("N" & x).Formula))
Next x
frmStats.lblCOH.Caption = Capital_on_Hold

frmStats.Show


--
mpeplow
------------------------------------------------------------------------
mpeplow's Profile: http://www.excelforum.com/member.php...o&userid=34812
View this thread: http://www.excelforum.com/showthread...hreadid=551944




mpeplow[_6_]

Display Value in 'Currency Format'
 

I get wrong number of arguments or invalid property assignment? Any
idea why? Do I need to Dim as String?


--
mpeplow
------------------------------------------------------------------------
mpeplow's Profile: http://www.excelforum.com/member.php...o&userid=34812
View this thread: http://www.excelforum.com/showthread...hreadid=551944


Bernie Deitrick

Display Value in 'Currency Format'
 
This worked fine for me....

Private Sub CommandButton1_Click()
Dim Capital_on_Hold As Currency
Capital_on_Hold = 1234.567
UserForm1.Label1.Caption = Format(Capital_on_Hold, "$#,##0.00")
End Sub

It may be that your newsreader inserted invalid characters...?

HTH,
Bernie
MS Excel MVP


"mpeplow" wrote in message
...

I get wrong number of arguments or invalid property assignment? Any
idea why? Do I need to Dim as String?


--
mpeplow
------------------------------------------------------------------------
mpeplow's Profile: http://www.excelforum.com/member.php...o&userid=34812
View this thread: http://www.excelforum.com/showthread...hreadid=551944





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

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