Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default For Each...Next statement

Thanks v. much for you help today, Tom

--
Message posted from http://www.ExcelForum.com

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
IF statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
Can an If statement answer an If statement? M.A.Tyler Excel Discussion (Misc queries) 2 June 24th 07 04:14 AM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM


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

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

About Us

"It's about Microsoft Excel"