Reputation: 6799
I am writing a user-defined function in VBA in Excel. The parameters I will pass this function when it is called are decimal values. For example:
Public Function fcn(param1 as Decimal, param2 as Decimal)
...
End Function
But I cant seem to define my parameters as Decimal type?
Upvotes: 2
Views: 2552
Reputation: 11893
From the VBA Language Reference for EXCEL 2010:
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.
Visual Basis for Applications Language Reference
-> Visual Basic Language Reference
-> Data Types
-> Decimal Data Type
This has been the case for several versions of EXCEL (at least since Office 97), and so I do not expect it to change in the near future.
Upvotes: 3