I am writing a loop in VBA for excel, and I would like to loop through a sequence of decimal numbers, rather than integers.
For example:
For i = 1 To 10
'Do something
Next i
But rather than incrementibg by 1, I would like to increment by 0.5 (or perhaps 5, or really any number other than 1).
Dim i as Single
For i = 1 To 10 Step 0.5
'
Next
But note you can get some unwanted numbers because of the floating numbers not being precise.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With