Formatting a label caption as "$##,###.##"

TAPS_MikeDion

Well-known Member
Joined
Aug 14, 2009
Messages
622
Office Version
  1. 2011
Platform
  1. MacOS
Does anyone know why I cannot get the following code to show the digits after the decimal point in my label caption?

Budget is the label name.

Everything works great except for the fact that I can't get it to display the cents.
1900 displays as "$1,900."
1900.00 displays as "$1,900."

No matter what is entered into the Excel sheet (the cells are also formatted as $##,###.## and it shows up correctly in the sheet) the label caption will not show what is after the decimal point.

Code:
Budget = " " & Format(ws.Cells(SelectedRow, 34).Value, "$##,###.##")

Thanks!
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Try:

Code:
Budget = " " & Format(ws.Cells(SelectedRow, 34).Value, "$##,###.[COLOR=#0000ff]00[/COLOR]")
 
Upvote 0
Hi Dante,
Thanks, but using that method only returns 00 for cents. Also, when used with (for example) $1900.50 the result is "$190,0.5.00"
 
Upvote 0
That may be because in the cell you have a text, check if in the cell you have a text or a numerical value.
 
Upvote 0
The column is formatted as numbers. It's okay, I figured out a different solution. It's longer, but it works. LOL
Thank you though. The budget for any location will never be high enough to require a hundred thousandths comma, so this morks.

For the record...

Code:
Sub BudgetNum()
    
    Dim BgtNum As String
    Dim OrigNum
    Dim ws As Worksheet    
    Set ws = Sheets("DataSheet")
    
    OrigNum = ws.Cells(PayrollInformationForm.ComboBox1.ListIndex + 2, 34).Value
    
    If Len(OrigNum) > 6 Then
        'Greater than $999.99
         BgtNum = " $" & _
        Left(OrigNum, Len(OrigNum) - 6) & _
        "," & Right(OrigNum, 6)
        PayrollInformationForm.Budget = BgtNum
    End If
    
End Sub
 
Upvote 0
:rofl: What the???
I just saw that I typed "morks" instead of works. Oh well. :)
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,141
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top