Re: VB number formats



you could try this, as long as there is a command button or somewhere to go
after the last textbox entry

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Me.TextBox1 = Format(Me.TextBox1.Value, "$#,###,###.00")
End Sub


--


Gary


"timmulla" <timmulla@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FE54A0AB-8EAC-42E1-9598-37BEAD82C11F@xxxxxxxxxxxxxxxx
Can somebody please help me with some VB number formats?

I have a textbox on a form that users manually input a percent. Is there a
way to set the number format to a percent through VB code? Currently, the
user needs to manually add the percent sign to the number they are inputing.
I would like the percent sign to automatically default to the numbers inputed
to the textbox.

I'm also trying to set a number format in another textbox as a currency
(i.e. $###,###.##). I would like the inputed dollar amount in this text box
to automatically default to a currency format of $###,###.##.

Not sure if this can be done through the properties window or not.

any information would be appreciated.

--
Regards,

timmulla


.



Relevant Pages

  • Re: textbox formatting questions
    ... Dim fBackwards As Boolean ... Private Sub TextBox1_Exit ... textbox automatically formats it. ... custom format of your choice ...
    (microsoft.public.excel.programming)
  • Re: inserting a default date in a textbox in a userform
    ... "Jay Freedman" skrev: ... >>How can I insert a date as a default in a textbox in a userform? ... > Note that Now is the current system date/time, and the Format function ... > Private Sub tbxDate_Exit ...
    (microsoft.public.word.vba.general)
  • Re: Text box in userform
    ... Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ... "Tim" wrote in message ... user leaves the textbox. ... it would format the date to this 04/13/04. ...
    (microsoft.public.excel.programming)
  • Re: Selection based on partial input
    ... > I need to enable the user to input the beginning of a name in the> textbox, ... > and, as each new typed character comes in, I want the listbox to> display ... Dim TextArray() As String ... Private Sub UserForm_Initialize ...
    (microsoft.public.excel.programming)
  • Re: Limit Textbox inputs to Format
    ... > associated format string for numeric input. ... > and also limit them to numbers in the format specified for each textbox. ... The following code requires your TextBox'es to be in a Control Array ... Private Sub Text1_GotFocus ...
    (microsoft.public.vb.general.discussion)