Thread: Round off error
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Round off error

You need to specify the Step used in the For loop. If you don't specify a
Step value, VBA uses 1.

Dim I As Double
For I = -0.2 To 0.2 Step 0.1
Debug.Print I
Next I


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"Harvey" wrote in message
...
Anyone knows how to eliminate roundoff error in a loop?

Dim i as double
for i= - 0.2 to 0.2
debug.print i
next

Thanks:)