ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Constructing Inner and Outer Loops in Excel VBA (https://www.excelbanter.com/excel-programming/356023-constructing-inner-outer-loops-excel-vba.html)

NazofMagna

Constructing Inner and Outer Loops in Excel VBA
 
Hi.

I was wondering how I could loop through a matrix of information, populate a
row in another worksheet with the values I pulled from the matrix, and then,
continue looping through other matrices, i.e.I'm looking for loop-within-loop
information,

for eg.

Matrix 1
sales = 50

profits = 60 debts = 30

Matrix 2
sales = 34

profits = 67 debts = 32

I want to construct an inner loop that can sort within each matrix, delete
any row with spaces, pick up each data point from different cells, store them
in one row in another worksheet, and then close that loop and have an outer
loop that will repeat the same action for each matrix, storing the values of
each matrix in a different row in the new worksheet.

I know it probably is a little complicated, but I was just hoping that
someone could help me out with the trickier aspects of the loop.

Thanks for reading this far, I appreciate it

Naz



Tom Ogilvy

Constructing Inner and Outer Loops in Excel VBA
 
for i = 1 to 10
for j = 1 to 20
for k = 1 to 5

next k
next j
next i

shows nested loops.

--
Regards,
Tom Ogilvy


"NazofMagna" wrote in message
...
Hi.

I was wondering how I could loop through a matrix of information, populate

a
row in another worksheet with the values I pulled from the matrix, and

then,
continue looping through other matrices, i.e.I'm looking for

loop-within-loop
information,

for eg.

Matrix 1
sales = 50

profits = 60 debts = 30

Matrix 2
sales = 34

profits = 67 debts = 32

I want to construct an inner loop that can sort within each matrix, delete
any row with spaces, pick up each data point from different cells, store

them
in one row in another worksheet, and then close that loop and have an

outer
loop that will repeat the same action for each matrix, storing the values

of
each matrix in a different row in the new worksheet.

I know it probably is a little complicated, but I was just hoping that
someone could help me out with the trickier aspects of the loop.

Thanks for reading this far, I appreciate it

Naz





NazofMagna

Constructing Inner and Outer Loops in Excel VBA
 
Thanks for the help Tom.

"Tom Ogilvy" wrote:

for i = 1 to 10
for j = 1 to 20
for k = 1 to 5

next k
next j
next i

shows nested loops.

--
Regards,
Tom Ogilvy


"NazofMagna" wrote in message
...
Hi.

I was wondering how I could loop through a matrix of information, populate

a
row in another worksheet with the values I pulled from the matrix, and

then,
continue looping through other matrices, i.e.I'm looking for

loop-within-loop
information,

for eg.

Matrix 1
sales = 50

profits = 60 debts = 30

Matrix 2
sales = 34

profits = 67 debts = 32

I want to construct an inner loop that can sort within each matrix, delete
any row with spaces, pick up each data point from different cells, store

them
in one row in another worksheet, and then close that loop and have an

outer
loop that will repeat the same action for each matrix, storing the values

of
each matrix in a different row in the new worksheet.

I know it probably is a little complicated, but I was just hoping that
someone could help me out with the trickier aspects of the loop.

Thanks for reading this far, I appreciate it

Naz







All times are GMT +1. The time now is 01:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com