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
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
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
>
>
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
> >
> >
>
>
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
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
> > >
> > >
> >
> >
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks