Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default reset the range of FOR loop

"for"get FOR. Use While:

Sub loopy()
topp = 5
i = 1
While i < topp
MsgBox (i)
topp = 8
i = i + 1
Wend
End Sub
--
Gary''s Student - gsnu200843


"Farooq Sheri" wrote:

I have the following bit of code in my macro.

For colCnt = 2 To lstCol

(lines of code here)

Next colCnt

Within the For loop certain conditions require changing the value of lstCol
(say it was 5 initially and it becomes 6). Is there a way to ensure that loop
executes till colCnt = 6 (inclusive). I tried setting lstCol = 6 but the loop
excutes only uptil 5.

Thanks for your help.

Reply
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
Loop through last cell/row of used range tkraju via OfficeKB.com Excel Discussion (Misc queries) 1 April 4th 09 04:45 PM
Is it possible to reset the starting cell in a For Loop Ayo Excel Discussion (Misc queries) 2 May 12th 08 06:27 PM
Loop QUESTION to end of data range... mniccole Excel Worksheet Functions 2 December 4th 06 09:25 PM
Loop QUESTION to end of data range... mniccole Excel Worksheet Functions 0 December 4th 06 03:59 PM
x y scatter chart series ranges reset to x(range) = y(range) Brakerm19 Charts and Charting in Excel 4 September 26th 06 11:13 PM


All times are GMT +1. The time now is 02: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"