+ Reply to Thread
Results 1 to 5 of 5

Simple but I can't remember

  1. #1
    Andibevan
    Guest

    Simple but I can't remember

    I know this is really forgetful of me but I can't find out what the correct
    data type for normal decimal numbers would be e.g. 21.45 or 123.45?

    TIA

    Andi



  2. #2
    Bob Phillips
    Guest

    Re: Simple but I can't remember

    Double.

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "Andibevan" <[email protected]> wrote in message
    news:[email protected]...
    > I know this is really forgetful of me but I can't find out what the

    correct
    > data type for normal decimal numbers would be e.g. 21.45 or 123.45?
    >
    > TIA
    >
    > Andi
    >
    >




  3. #3
    Andibevan
    Guest

    Re: Simple but I can't remember

    How do I format something to have 2 decimal places?

    The following returns 12.1 not 12.10

    Dim lNewRev As Double
    lNewRev = 12.1
    lNewRev = Format(lNewRev, "###0.00")
    Debug.Print lNewRev


    "Bob Phillips" <[email protected]> wrote in message
    news:[email protected]...
    > Double.
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > (remove nothere from email address if mailing direct)
    >
    > "Andibevan" <[email protected]> wrote in message
    > news:[email protected]...
    > > I know this is really forgetful of me but I can't find out what the

    > correct
    > > data type for normal decimal numbers would be e.g. 21.45 or 123.45?
    > >
    > > TIA
    > >
    > > Andi
    > >
    > >

    >
    >




  4. #4
    Dave Peterson
    Guest

    Re: Simple but I can't remember

    It sounds like you want to display the value formatted to two decimal places:

    Dim lNewRev As Double
    Dim lNewRevStr as String
    lNewRev = 12.1
    lNewRevStr = Format(lNewRev, "###0.00")
    Debug.Print lNewRevStr

    'or just
    debug.print Format(lNewRev, "###0.00")

    Andibevan wrote:
    >
    > How do I format something to have 2 decimal places?
    >
    > The following returns 12.1 not 12.10
    >
    > Dim lNewRev As Double
    > lNewRev = 12.1
    > lNewRev = Format(lNewRev, "###0.00")
    > Debug.Print lNewRev
    >
    > "Bob Phillips" <[email protected]> wrote in message
    > news:[email protected]...
    > > Double.
    > >
    > > --
    > > HTH
    > >
    > > Bob Phillips
    > >
    > > (remove nothere from email address if mailing direct)
    > >
    > > "Andibevan" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > I know this is really forgetful of me but I can't find out what the

    > > correct
    > > > data type for normal decimal numbers would be e.g. 21.45 or 123.45?
    > > >
    > > > TIA
    > > >
    > > > Andi
    > > >
    > > >

    > >
    > >


    --

    Dave Peterson

  5. #5
    Bob Phillips
    Guest

    Re: Simple but I can't remember

    That is because Format returns a string, but you are still using the double.

    Try

    Dim lNewRev As Double
    Dim sFormat As String

    lNewRev = 12.1
    sFormat = Format(lNewRev, "###0.00")
    Debug.Print sFormat

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "Andibevan" <[email protected]> wrote in message
    news:[email protected]...
    > How do I format something to have 2 decimal places?
    >
    > The following returns 12.1 not 12.10
    >
    > Dim lNewRev As Double
    > lNewRev = 12.1
    > lNewRev = Format(lNewRev, "###0.00")
    > Debug.Print lNewRev
    >
    >
    > "Bob Phillips" <[email protected]> wrote in message
    > news:[email protected]...
    > > Double.
    > >
    > > --
    > > HTH
    > >
    > > Bob Phillips
    > >
    > > (remove nothere from email address if mailing direct)
    > >
    > > "Andibevan" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > I know this is really forgetful of me but I can't find out what the

    > > correct
    > > > data type for normal decimal numbers would be e.g. 21.45 or 123.45?
    > > >
    > > > TIA
    > > >
    > > > Andi
    > > >
    > > >

    > >
    > >

    >
    >




+ 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