From what I understood of VBA, it seems that Type characters (MS Docs - Type characters) are mostly used during the declaration process of variables, to shorten code lines and use implicit declaration while still forcing a data type.
On the other hand, Type conversion functions (MS Docs - Type conversion functions) are mostly used in calculations and value conversion to ensure type compatibility between variables.
But I have seen type characters beeing used in formulas where type conversion functions could have been. So what are the differences between these two methods ? Which one should I use and when ? What is the best practice ?
For example, what are the differences between each calculation of b
in the following code:
Dim a As Integer, b As Double
a = 4
b = a# * 10.0
b = a * 10#
b = CDbl(a * 10)
b = CDbl(a) * CDbl(10)
Pardon me if this question is dumb or if it has already been answered somewhere on this site.