close

I have a function that brings in four different cell ranges:
ie: Total(AccountRange As Range, DateRange As Range, etc...)

Within the VB function I have a For/Next Loop as follows:
ie: For Each cell in AccountRange
quot;multiple if statementsquot;
Next cell

I want to increment the rows in the other cell ranges during the looping
process. When the AccountRange row increases during the quot;Next cellquot; call
then I want the other ranges to follow suit.

By the way what actually happens during the looping process for a range of
cells? If the range is 2 columns by 4 rows does the quot;Next cellquot; call go down
the rows then jump to the top of the 2nd column and again proceed down the
rows??


quot;Freemanquot; gt; wrote in message
...
gt; I have a function that brings in four different cell ranges:
gt; ie: Total(AccountRange As Range, DateRange As Range, etc...)
gt;
gt; Within the VB function I have a For/Next Loop as follows:
gt; ie: For Each cell in AccountRange
gt; quot;multiple if statementsquot;
gt; Next cell
gt;
gt; I want to increment the rows in the other cell ranges during the looping
gt; process. When the AccountRange row increases during the quot;Next cellquot; call
gt; then I want the other ranges to follow suit.

What exactly do you mean? You can get the row by simply using

cell.Row

but I am not clear as to what you mane by increment the rows in the other
cell ranges.

gt; By the way what actually happens during the looping process for a range of
gt; cells? If the range is 2 columns by 4 rows does the quot;Next cellquot; call go
down
gt; the rows then jump to the top of the 2nd column and again proceed down the
gt; rows??

No, other way. It goes across the columns, then down to the first column of
the next row.
BTW, you can force it down the rows, then next column with

For Each cell in Application.Transpose(rng)

but you are not working with a range object now, but an array of values.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

quot;Freemanquot; gt; wrote in message
...
gt; I have a function that brings in four different cell ranges:
gt; ie: Total(AccountRange As Range, DateRange As Range, etc...)
gt;
gt; Within the VB function I have a For/Next Loop as follows:
gt; ie: For Each cell in AccountRange
gt; quot;multiple if statementsquot;
gt; Next cell
gt;
gt; I want to increment the rows in the other cell ranges during the looping
gt; process. When the AccountRange row increases during the quot;Next cellquot; call
gt; then I want the other ranges to follow suit.
gt;
gt; By the way what actually happens during the looping process for a range of
gt; cells? If the range is 2 columns by 4 rows does the quot;Next cellquot; call go
down
gt; the rows then jump to the top of the 2nd column and again proceed down the
gt; rows??

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()