View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Assigned specific decimal space

Excel stores all numbers as double.

Dim myNumber as double

myNumber = 42352975.3687


a# uses the implicit designator # which types it as double - used in the
immediate window only for demonstration as you can't type variables in the
immediate window:

? typename(A#)
Double
a# = 42352975.3687
? a
42352975.3687
a# = 234567.25
? a
234567.25
? format(a,"$#,##0.00")
$234,567.25


--
Regards,
Tom Ogilvy




"James" wrote in message
oups.com...
To assign space for an Excel (2003) column that required maximum 5
characters, I declared it as Dim strCompound String * 5.
But I do not know how to fit specific requirements for my designated
calculation fields (I have no VBA help file to lookup!!!):

- Declare a variable that has maximum 8 digits and 4 decimals (i.e.:
42352975.3687).

- Declare a variable with currency value that has maximum of 6 digits
and 2 decimals ( i.e.: $234567.25)

I began to use macro since last month and do not know if there is a
way to meet the needs for those columns. Please show me the rope if
possible. Thank you. James