LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Why this basic LOOP does not work!

Hi,

I have the following simple loop where I want "i' to go from 1 to 3.

Sub test()
For i = 1 To 3
Debug.Print "Inside of the loop"; i
Next
Debug.Print "Outside of the loop"; i
End Sub


==Out put is ==
Inside of the loop 1
Inside of the loop 2
Inside of the loop 3
Outside of the loop 4


It does what I expect inside the loop. But, as soon as loop is completed its
value increases by one to 4 although I see no reason for this. Why? Anybody
has any answer for this?

Thanks.
 
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
For Each - loop doesn't work. Intellihome[_31_] Excel Programming 3 June 29th 05 11:10 PM
Excel Visual Basic - need help to create a loop of filenames dgates12 Excel Programming 3 May 12th 05 01:22 PM
Excel formula similar to a loop in Basic? Cashtime Excel Worksheet Functions 2 February 6th 05 07:53 PM
Would a loop work? sixfivebeastman[_7_] Excel Programming 1 August 31st 04 03:12 PM
Why doesn't my loop work? Insp Gadget Excel Programming 5 December 22nd 03 10:56 AM


All times are GMT +1. The time now is 05:39 PM.

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"