Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Simple but I can't remember

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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" 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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" 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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" 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I cannot remember... nginear Excel Discussion (Misc queries) 3 September 17th 09 05:18 PM
Can someone please help me to remember tzap_1998 New Users to Excel 2 January 25th 08 11:22 AM
I used to be able to do this, I can't remember how punter Excel Discussion (Misc queries) 3 March 2nd 06 04:22 PM
I can't remember how to... ForSale[_56_] Excel Programming 5 June 14th 05 05:26 AM
Remember and add valeter New Users to Excel 2 April 13th 05 11:46 PM


All times are GMT +1. The time now is 11:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"