![]() |
How to use Decimal data type?
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 |
How to use Decimal data type?
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 "Sun Tzu" wrote in message ups.com... | 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 | |
How to use Decimal data type?
I'd use:
Dim decX as variant decx = cdec(someothervariable) Sun Tzu wrote: 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 -- Dave Peterson |
How to use Decimal data type?
Hi,
Use 'Single' for 7 decimals of precision or 'Double' for 15 decimals of precision Mike. "Sun Tzu" wrote: 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 |
How to use Decimal data type?
I see now.
Thanks much! Wes On Nov 7, 8:44 am, "Niek Otten" wrote: 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 "Sun Tzu" wrote in oglegroups.com... | 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 | |
How to use Decimal data type?
Hi, Mike,
Unfortunately, not all decimal values convert accurately to binary formats. That's why Decimal format exists. Thanks, Wes On Nov 7, 8:51 am, Mike H wrote: Hi, Use 'Single' for 7 decimals of precision or 'Double' for 15 decimals of precision Mike. "Sun Tzu" wrote: 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- Hide quoted text - - Show quoted text - |
How to use Decimal data type?
Thanks, Dave!
Wes On Nov 7, 8:45 am, Dave Peterson wrote: I'd use: Dim decX as variant decx = cdec(someothervariable) Sun Tzu wrote: 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 -- Dave Peterson |
All times are GMT +1. The time now is 08:40 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com