VBA Decimal

I am optimizing a macro in VBA that was not declared by any of the data types, so everything was inconveniently handled by the compiler as an option. I deal with scientific measurements, so I need accuracy. How to declare "Dim decAsdf as decimal" (not so, but correct)?

+18
source share
2 answers

You cannot declare a variable as Decimal- you need to use Variant(you can use CDecto populate it with a type Decimal).

+19
source

- Single Double . Single 4 -3.402823E38 1.401298E45. Double 8 .

:

Dim decAsdf as Single

Dim decAsdf as Double

, . , , .

Sub doubleDataTypeExample()
Dim doubleTest As Double


doubleTest = 0.0000045 * 0.005 * 0.01

MsgBox "doubleTest = " & doubleTest
End Sub
+1

All Articles