LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default loop using double

I just ran this code in Excel 2003 and it ran exactly as expected.
But typically I've only seen integers allowed in loops. Excel seems
to be the exception to this rule. This code could be written as:

Sub test()
Dim i As integer
Dim j As double

j = 0.2
For i = -15 To 15
Debug.Assert i*j < 3
Debug.Print i*j
Next

But I am not familiar with the debug command. What do Debug.Assert
and Debug.Print do?

On Nov 8, 3:40*am, heev wrote:
I have the following sub.

Sub test()
Dim i As Double
Dim j As Double

j = 0.2
For i = -3 To 3 Step j
Debug.Assert i < 3
* * Debug.Print i
Next
End Sub

If I run this code the last step 3 will not run.
If I modify I to 2.5 it does. What's going on?




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Double Double Quotes [email protected] Excel Programming 5 June 20th 07 02:14 PM
Help with double loop Marcu2 Excel Programming 2 February 13th 07 05:03 PM
double axis, double problem (i hope only to me) kitcho Charts and Charting in Excel 1 December 30th 06 12:52 AM
Help with "double" loop! erikhs[_15_] Excel Programming 4 July 26th 06 05:39 PM
double loop madness - help with macro Nicole Seibert Excel Programming 1 April 6th 06 07:26 AM


All times are GMT +1. The time now is 01:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"