OzGrid

Convert to a Decimal Data Type

< Back to Search results

 Category: [Excel]  Demo Available 

Convert to a Decimal Data Type

 

Excel VBA: Convert to a Decimal Data Type

Got any Excel/VBA Questions? Free Excel Help.

The example below shows how CDec can be used in Excel VBA to convert to a Decimal data type.  +/-79,228,162,514,264,337,593,543,950,335 for zero-scaled numbers, that is, numbers with no decimal places. For numbers with 28 decimal places, the range is +/-7.9228162514264337593543950335. The smallest possible non-zero number is 0.0000000000000000000000000001

Sub ConvertToDecimal()

Dim vDec, decNum



vDec = "10000000.0587"

decNum = CDec(vDec + 1)

MsgBox decNum



End Sub
 

 

See also:

Convert a String or Number to Boolean
Convert a String to a Byte Data Type
Convert to a Currency Data Type
Convert to a Date Data Type
Convert to a Double Data Type
Convert to a Integer Data Type
Excel VBA: Convert to a Long Data Type
Convert to a Single Data Type
Convert to a String Data Type
Convert Excel Text To Upper Case

 

Free Training Course: Lesson 1 - Excel Fundamentals

 

See also: Index to Excel VBA Code; Index to Excel Freebies; Lesson 1 - Excel Fundamentals; Index to how to… providing a range of solutions

 

Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.


Gallery



stars (0 Reviews)