Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
For Each...Next statement
Hi,
Not that familiar with loops etc. I think what I need is for..next statement loop, as this is for each element in group. My group would be list of varialbes (integers) that are non-sequential, that are gained via match function in VBA (they are column numbers of data). So, looping through 1,4,7,9,15 etc., rather than 1,2,3,4 etc. I have searched and searched but cannot get my head round how to create group or array to achieve this. The code that I want to use in my loop is below (not that relevant to question); Set riBoxxFilteredCol = Intersect(ActiveSheet.Columns(iIBOXXColNo), rng) ' Loops through series of integer variables riBoxxFilteredCol.Copy Worksheet(NowSheetName).Activate Range("B1").Activate ActiveCell.Offset(0, iNowColNo).Activate ' This is varialbe in loop (1 to 9) It's iBOXXColNo that will loop through non-sequential list mentioned above. Thanks in advance. --- Message posted from http://www.ExcelForum.com/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
For Each...Next statement
varr = Array( 1,4,7,9,15)
for i = lbound(varr) to ubound(varr) iIBOXXColNo = varr(i) . . . Next -- Regards, Tom Ogilvy "Hardy " wrote in message ... Hi, Not that familiar with loops etc. I think what I need is for..next statement loop, as this is for each element in group. My group would be list of varialbes (integers) that are non-sequential, that are gained via match function in VBA (they are column numbers of data). So, looping through 1,4,7,9,15 etc., rather than 1,2,3,4 etc. I have searched and searched but cannot get my head round how to create group or array to achieve this. The code that I want to use in my loop is below (not that relevant to question); Set riBoxxFilteredCol = Intersect(ActiveSheet.Columns(iIBOXXColNo), rng) ' Loops through series of integer variables riBoxxFilteredCol.Copy Worksheet(NowSheetName).Activate Range("B1").Activate ActiveCell.Offset(0, iNowColNo).Activate ' This is varialbe in loop (1 to 9) It's iBOXXColNo that will loop through non-sequential list mentioned above. Thanks in advance. --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
For Each...Next statement
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF statement inside a SUMIF statement.... or alternative method | Excel Worksheet Functions | |||
Reconcile Bank statement & Credit card statement & accounting data | Excel Worksheet Functions | |||
Embedding an OR statement in an IF statement efficiently | Excel Discussion (Misc queries) | |||
Can an If statement answer an If statement? | Excel Discussion (Misc queries) | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions |