Hi, I wrote the following code using a for loop:
Sub test()
Dim n As Double, t As Double
t = 1.5
Range("A2").Select
For n = 0 To t Step 0.1
ActiveCell.Value = n
ActiveCell.Offset(1, 0).Select
Next n
End Sub
This is supposed to output values from 0 to 1.5 in column A at 0.1 intervals.
The issue I'm facing is that for values upto t=1.3, the last output value is 1.3, However if I put t=1.4 it still gives the last value as 1.3
if t=1.5, last output value is 1.4! for t=1.6 last output is 1.7 and so on...
This continues till t=4.7, after which for t=4.8 last value is also 4.8
Any suggestions on what's going on?
Sub test()
Dim n As Double, t As Double
t = 1.5
Range("A2").Select
For n = 0 To t Step 0.1
ActiveCell.Value = n
ActiveCell.Offset(1, 0).Select
Next n
End Sub
This is supposed to output values from 0 to 1.5 in column A at 0.1 intervals.
The issue I'm facing is that for values upto t=1.3, the last output value is 1.3, However if I put t=1.4 it still gives the last value as 1.3
if t=1.5, last output value is 1.4! for t=1.6 last output is 1.7 and so on...
This continues till t=4.7, after which for t=4.8 last value is also 4.8
Any suggestions on what's going on?