Dynamic # of Nested For loops with given min, max, and step #s

Navenine

New Member
Joined
Apr 27, 2014
Messages
1
Hello All,

I'm working on a problem where I'm iterating through possible combinations of components, I have a sheet that has in Col(F) the Min, Col(G) the Max, and Col(H) the steps; similar to how a For Min to Max step Steps function would work.

I've recorded all of these values by
Dim Min(1 To 100) As Double
Dim Max(1 To 100) As Double
Dim Step(1 To 100) As Double
and reading from the sheet into the min, max, and step variables.

So here's the problem, in Col(A) I have the Machine Name so I need a nested for loop for all of the components of that machine (which could be anywhere from 1 to 10 (but possibly more in the future) components. Then my macro moves to the next machine name, grabs the min, max, and steps variables for that machine's components and I need it to again create and preform a nested for loop for that machines components.

I've written the Master For Loop that moves from one machine to the next and saves the min, max, and step; I save those variables as Min(RowNumber), Max(RowNumber), Step(RowNumber)

for every iteration I need the nested for loop value printed to Col(I) the '# of Components' column and the sheet preforms basic calculations in formulas to determine the efficacy of that combination. My macro saves the 'optimal solution' and then prints it out for all of those components before moving on to the next machine.

I've never used recursive functions so if an answer includes that functionality please write with that in mind. I've searched and studied but haven't been able to understand how to manipulate their functionality.

Thank you in advance for your help!!!!

Cheers,
-Evan
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,223,262
Messages
6,171,080
Members
452,377
Latest member
bradfordsam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top