+ Reply to Thread
Results 1 to 4 of 4

Digits after the comma in Userform

  1. #1
    Gert-Jan
    Guest

    Digits after the comma in Userform

    In my database-sheet there are amounts, that can have one digit after the
    comma (f.a. 540,7 or 540). In my userform I want these amounts shown as
    $540,70 / $540,00. How can I do that?



  2. #2
    Bob Phillips
    Guest

    Re: Digits after the comma in Userform

    Try this

    Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    textbox1.Text=format(textbox1.Text,"$0,00")
    End Sub


    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Gert-Jan" <[email protected]> wrote in message
    news:[email protected]...
    > In my database-sheet there are amounts, that can have one digit after the
    > comma (f.a. 540,7 or 540). In my userform I want these amounts shown as
    > $540,70 / $540,00. How can I do that?
    >
    >




  3. #3
    Gert-Jan
    Guest

    Re: Digits after the comma in Userform

    Thanks, Bob.

    I changed the code a bit, now it works fine: (mb2 =label)

    mb2.Caption = Range("Sheets3!Q3").Value
    mb2.Caption = Format(mb2.Caption, "?0.00")

    Gert-Jan

    "Bob Phillips" <[email protected]> schreef in bericht
    news:e4r%[email protected]...
    > Try this
    >
    > Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    > textbox1.Text=format(textbox1.Text,"$0,00")
    > End Sub
    >
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (replace somewhere in email address with gmail if mailing direct)
    >
    > "Gert-Jan" <[email protected]> wrote in message
    > news:[email protected]...
    >> In my database-sheet there are amounts, that can have one digit after the
    >> comma (f.a. 540,7 or 540). In my userform I want these amounts shown as
    >> $540,70 / $540,00. How can I do that?
    >>
    >>

    >
    >




  4. #4
    Bob Phillips
    Guest

    Re: Digits after the comma in Userform

    Hi Gert-Jan,

    If you are getting data from a cell, and that cell is already formatted, you
    could just use

    mb2.Caption = Range("Sheets3!Q3").Text

    or at least do it in one move

    mb2.Caption = Format(Range("Sheets3!Q3").Value, "?0.00")

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "Gert-Jan" <[email protected]> wrote in message
    news:[email protected]...
    > Thanks, Bob.
    >
    > I changed the code a bit, now it works fine: (mb2 =label)
    >
    > mb2.Caption = Range("Sheets3!Q3").Value
    > mb2.Caption = Format(mb2.Caption, "?0.00")
    >
    > Gert-Jan
    >
    > "Bob Phillips" <[email protected]> schreef in bericht
    > news:e4r%[email protected]...
    > > Try this
    > >
    > > Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    > > textbox1.Text=format(textbox1.Text,"$0,00")
    > > End Sub
    > >
    > >
    > > --
    > > HTH
    > >
    > > Bob Phillips
    > >
    > > (replace somewhere in email address with gmail if mailing direct)
    > >
    > > "Gert-Jan" <[email protected]> wrote in message
    > > news:[email protected]...
    > >> In my database-sheet there are amounts, that can have one digit after

    the
    > >> comma (f.a. 540,7 or 540). In my userform I want these amounts shown as
    > >> $540,70 / $540,00. How can I do that?
    > >>
    > >>

    > >
    > >

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1