Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Currency Format for label in UserForm
I'm trying to apply the currency format to a label in a UserForm with the
following code: Private Sub UserForm_Initialize() Me.lblBudget.Value = FormatCurrency(Me.lblBudget, "#,###,###.00") End Sub But every time I try to run it, I get an error that leads to the ".Value" after lbl.budget. Should I be doing this another way? Thanks for your help!! -Allen |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Currency Format for label in UserForm
Possibly something like:
lblBudget.Caption = Format(lblBudget.Caption, "$ #,###,###.00") or lblBudget.Caption = Format(CInt(lblBudget.Caption), "$ #,###,###.00") I just can't get the syntax right! -Allen "Allen Geddes" wrote: I'm trying to apply the currency format to a label in a UserForm with the following code: Private Sub UserForm_Initialize() Me.lblBudget.Value = FormatCurrency(Me.lblBudget, "#,###,###.00") End Sub But every time I try to run it, I get an error that leads to the ".Value" after lbl.budget. Should I be doing this another way? Thanks for your help!! -Allen |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Currency Format for label in UserForm
I designed a userform with a label on it. While in design mode, I put:
12345.32 in the label's caption (using the properties window. Then this worked ok for me: Private Sub UserForm_Initialize() lblBudget.Caption = Format(lblBudget.Caption, "$ #,###,###.00") End Sub But it seems strange to me that you're changing the caption based on the existing caption. Is that what you really wanted? Allen Geddes wrote: Possibly something like: lblBudget.Caption = Format(lblBudget.Caption, "$ #,###,###.00") or lblBudget.Caption = Format(CInt(lblBudget.Caption), "$ #,###,###.00") I just can't get the syntax right! -Allen "Allen Geddes" wrote: I'm trying to apply the currency format to a label in a UserForm with the following code: Private Sub UserForm_Initialize() Me.lblBudget.Value = FormatCurrency(Me.lblBudget, "#,###,###.00") End Sub But every time I try to run it, I get an error that leads to the ".Value" after lbl.budget. Should I be doing this another way? Thanks for your help!! -Allen -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Currency Format for label in UserForm
You're right. I tried the same thing, and it worked for me too! So that got
me thinking, WHY wouldn't it work in my Actual UserForm, but it would in the Test UserForm... Well, it's all about where you place it. I had it BEFORE the line of code where I populate the label with a number from a workbook... and nada. But, when I move the Format to Currency line to the END of the Sub, it worked beautifully! Thanks for your help Dave!!! -Allen "Dave Peterson" wrote: I designed a userform with a label on it. While in design mode, I put: 12345.32 in the label's caption (using the properties window. Then this worked ok for me: Private Sub UserForm_Initialize() lblBudget.Caption = Format(lblBudget.Caption, "$ #,###,###.00") End Sub But it seems strange to me that you're changing the caption based on the existing caption. Is that what you really wanted? Allen Geddes wrote: Possibly something like: lblBudget.Caption = Format(lblBudget.Caption, "$ #,###,###.00") or lblBudget.Caption = Format(CInt(lblBudget.Caption), "$ #,###,###.00") I just can't get the syntax right! -Allen "Allen Geddes" wrote: I'm trying to apply the currency format to a label in a UserForm with the following code: Private Sub UserForm_Initialize() Me.lblBudget.Value = FormatCurrency(Me.lblBudget, "#,###,###.00") End Sub But every time I try to run it, I get an error that leads to the ".Value" after lbl.budget. Should I be doing this another way? Thanks for your help!! -Allen -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
TextBox on a userform - format to currency & percent | Excel Discussion (Misc queries) | |||
UserForm TextBoxes - Is there a way to format as currency or perce | Excel Discussion (Misc queries) | |||
Currency Format on UserForm when opened! | Excel Discussion (Misc queries) | |||
UserForm Label & Format Problems | Excel Programming | |||
Userform Textbox Currency Format Problems | Excel Programming |