Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Double.
-- HTH Bob Phillips (remove nothere from email address if mailing direct) "Andibevan" wrote in message ... 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... Double. -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Andibevan" wrote in message ... 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... Double. -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Andibevan" wrote in message ... 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... 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" wrote in message ... Double. -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Andibevan" wrote in message ... 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I cannot remember... | Excel Discussion (Misc queries) | |||
Can someone please help me to remember | New Users to Excel | |||
I used to be able to do this, I can't remember how | Excel Discussion (Misc queries) | |||
I can't remember how to... | Excel Programming | |||
Remember and add | New Users to Excel |