Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Userform Text box Format to Currency

Hello,

I have a userform that has appx. 60 textboxes. It is a form for entry of
different dollar values. Each textbox has a control source to a named range
on the excel sheet.

How can I set each textbox to a currency format when the user opens the
form?

Thanks

David Mongrain

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Userform Text box Format to Currency

The short answer is you can't. Means you have to format as necessary when
done, eg

Private mCur as Currency ' at module level

Private Sub TextBox1_AfterUpdate()
Dim s as String
On Error Resume Next
s = Replace(TextBox1.Text, "$", "")
mCur = Val(Replace(TextBox1.Text, "$", ""))
mCur = Round(mCur, 2)

TextBox1.Text = Format(mCur, "$#,##0.00")
End Sub

You might want to do more than that minimum

Regards,
Peter T


"Dave M" wrote in message
...
Hello,

I have a userform that has appx. 60 textboxes. It is a form for entry of
different dollar values. Each textbox has a control source to a named
range
on the excel sheet.

How can I set each textbox to a currency format when the user opens the
form?

Thanks

David Mongrain



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Userform Text box Format to Currency

I found a way. On userform_activate, perform a loop of each contorl. If it
is a textbox, then set focus on it.

For each required textbox, have an onexit event, textbox1.value =
format(textbox1.value, "currency")


Thanks,

David
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
Currency Format on UserForm when opened! Robo[_2_] Excel Discussion (Misc queries) 3 May 8th 07 02:42 PM
Currency Format for label in UserForm Allen Geddes Excel Programming 3 November 18th 05 06:30 PM
Conversion from currency value to currency text format Frank Kabel Excel Programming 1 August 18th 04 10:06 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:04 AM.

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

About Us

"It's about Microsoft Excel"