[Solved] VBA – When passing on 0,02 to an Integer, it’s Value is 0


Read up on your Visual Basic for Applications data types here on MSDN

Code example for the basic numeric types:

Sub Some_sub()

Dim a As Double
Dim b As Long
Dim c As Integer
Dim d As Single

a = 0.02 
b = 0.02 
c = 0.02 
d = 0.02 

Debug.Print a 'output: 0.02
Debug.Print b 'output: 0
Debug.Print c 'output: 0
Debug.Print d 'output: 0.02

End Sub

As said in the comments: Use Single or Double.

solved VBA – When passing on 0,02 to an Integer, it’s Value is 0