LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default For Loop

Hi Harish, see if this does what you want.

Sub terfuge()
Dim j, k

j = 1
k = 1

With ActiveSheet
For j = 1 To 80
.Cells(j, 1) = j
.Cells(j, 2) = k + 1
k = k + 1
If j 1 And j Mod 20 = 0 Then
k = 1
End If
Next
End With
End Sub


"Harish" wrote:

Hi Gary,

your logic works correctly. I work with a automated testing software
and I want to use your logic in that software. This software uses VB
scripting language. I tried to implement your logic in it but it
doesnt work. I want to mention that j = 1 to 20 for some time and then
changes to j = 21 to 40 and then changes to 41 to 60. but k has to
restart everytime j = 21, 41, 61 and so on....Here is my code and I
would appreciate if you can correct the logic behind:

For j = firstnum to secondnum
If j mod(row_count-1) <0 Then
k=j+1
invoice_array(j) = Browser("").Page("_3").Frame
("_sweview_3").WebTable("Select for MultiPay").GetCellData(k,5)
Else
k=j+1
invoice_array(j) = Browser("").Page("_3").Frame("_sweview_3").WebTabl e
("Select for MultiPay").GetCellData(k,5)
k=0
End If
End if
k=k+1
Next

firstnum and second are variables that keeps changing like i said
before (1-20, 21-40, 41-60).

Thanks for your help



 
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
returning back to loop check condition without completing the loop ashish128 Excel Programming 13 April 3rd 08 12:53 PM
Loop to Filter, Name Sheets. If Blank, Exit Loop ryguy7272 Excel Programming 3 February 5th 08 03:41 PM
Naming Worksheets - Loop within a loop issue klysell Excel Programming 5 March 29th 07 05:48 AM
Naming Worksheets - Loop within a loop issue klysell Excel Programming 0 March 27th 07 11:17 PM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM


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