Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default 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
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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
|





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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 -



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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


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
How to type format time in decimal format & calculate time Cheyenne Excel Discussion (Misc queries) 1 February 13th 09 12:09 AM
How to type format time in decimal format & calculate Cheyenne Excel Discussion (Misc queries) 1 February 12th 09 11:54 PM
when I type numbers in a cell it changes it to a decimal point Ton[_2_] Excel Discussion (Misc queries) 4 October 1st 08 09:54 PM
ALL NUMBERS I TYPE HAVE DECIMAL POINT PAPA ROSS Excel Discussion (Misc queries) 3 May 7th 08 09:13 PM
Decimal type in Excel 97 E-Cube Excel Programming 2 November 18th 05 10:22 PM


All times are GMT +1. The time now is 03:56 AM.

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

About Us

"It's about Microsoft Excel"