How to use Decimal data type?

  • Thread starter Thread starter Sun Tzu
  • Start date Start date
S

Sun Tzu

Excel VBA Editor Help says Decimal is a supported data type, but
defining a variable as Decimal does not work.

Dim decX as Decimal

How can I do this? Is there a reference that I need to add?

Thanks,
Wes
 
Also from VBA Help:

Note At this time the Decimal data type can only be used within a Variant, that is, you cannot declare a variable to be of type
Decimal. You can, however, create a Variant whose subtype is Decimal using the CDec function.


--
Kind regards,

Niek Otten
Microsoft MVP - Excel


| Excel VBA Editor Help says Decimal is a supported data type, but
| defining a variable as Decimal does not work.
|
| Dim decX as Decimal
|
| How can I do this? Is there a reference that I need to add?
|
| Thanks,
| Wes
|
 
Hi,

Use 'Single' for 7 decimals of precision or 'Double' for 15 decimals of
precision

Mike.
 
Hi, Mike,

Unfortunately, not all decimal values convert accurately to binary
formats. That's why Decimal format exists.

Thanks,
Wes
 
Back
Top