Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TextBox on a userform - format to currency & percent Terry Excel Discussion (Misc queries) 2 September 12th 08 02:46 PM
UserForm TextBoxes - Is there a way to format as currency or perce Terry Excel Discussion (Misc queries) 0 September 11th 08 06:27 PM
Currency Format on UserForm when opened! Robo[_2_] Excel Discussion (Misc queries) 3 May 8th 07 02:42 PM
UserForm Label & Format Problems Mark Driscol Excel Programming 5 April 14th 04 08:33 PM
Userform Textbox Currency Format Problems Dunce in SC Excel Programming 2 October 27th 03 12:45 AM


All times are GMT +1. The time now is 09:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"