I'm not happy working off-forum in that way: it places you in the hands of my availability and I think it's a bad idea to exclude others from contributing potentially better solutions or enhancements. But I'm happy to give you an idea on how you could proceed.
For example, if you have a sheet containing your calculations called
Main which expects input in D1 and places its output in E1, create a sheet called
Values with a list of inputs in column A and run the following code:-
Code:
Option Explicit
Public Sub LoopValues()
Dim iLast As Long
Dim iPtr As Long
With Sheets("Values")
iLast = .Cells(.Rows.Count, 1).End(xlUp).Row
End With
For iPtr = 2 To iLast [COLOR=green]' start from row 2 to allow for column headings[/COLOR]
[COLOR=blue][B] Sheets("Main").Range("D1") = Sheets("Values").Range("A" & CStr(iPtr)).Value[/B][/COLOR]
Do Until Application.CalculationState = xlDone: Loop
[COLOR=red][B] Sheets("Values").Range("B" & CStr(iPtr)) = Sheets("Main").Range("E1").Value[/B][/COLOR]
Next iPtr
MsgBox CStr(iLast-1) & " sets of values calculated", vbOKOnly + vbInformation
End Sub
The blue line of code takes an input from
Values and places it in the appropriate cell in
Main, the following line waits for all the Excel calculations to complete, and the red line of code places the result back in
Values.
You would modify the blue and red bits to suit. For example, if
Main needed its inputs to be in A13, J44 and Z16, and it placed its outputs in E13 and T20, your
Values sheet would contain inputs in columns A, B and C and the outputs would appear in columns D and E. In that case the VBA code would be:-
Code:
For iPtr = 2 To iLast
Sheets("[COLOR=red][B]Main[/B][/COLOR]").Range("[B][COLOR=red]A13[/COLOR][/B]") = Sheets("[B][COLOR=#0000ff]Values[/COLOR][/B]").Range("[B][COLOR=blue]A[/COLOR][/B]" & CStr(iPtr)).Value
Sheets("[COLOR=red][B]Main[/B][/COLOR]").Range("[B][COLOR=red]J44[/COLOR][/B]") = Sheets("[B][COLOR=#0000ff]Values[/COLOR][/B]").Range("[B][COLOR=blue]B[/COLOR][/B]" & CStr(iPtr)).Value
Sheets("[COLOR=red][B]Main[/B][/COLOR]").Range("[B][COLOR=red]Z16[/COLOR][/B]") = Sheets("[B][COLOR=#0000ff]Values[/COLOR][/B]").Range("[B][COLOR=blue]C[/COLOR][/B]" & CStr(iPtr)).Value
Do Until Application.CalculationState = xlDone: Loop
Sheets("[COLOR=blue][B]Values[/B][/COLOR]").Range("[B][COLOR=blue]D[/COLOR][/B]" & CStr(iPtr)) = Sheets("[COLOR=red][B]Main[/B][/COLOR]").Range("[B][COLOR=red]E13[/COLOR][/B]").Value
Sheets("[B][COLOR=#0000ff]Values[/COLOR][/B]").Range("[B][COLOR=blue]E[/COLOR][/B]" & CStr(iPtr)) = Sheets("[COLOR=red][B]Main[/B][/COLOR]").Range("[B][COLOR=red]T20[/COLOR][/B]").Value
Next iPtr
Can I suggest you set up a new workbook with two sheets in it,
Main and
Values, set up some simple calculations in
Main, create some sample inputs in
Values, and give the code a try. Satisfy yourself that you understand what's going on and then see if it's sensible and feasible to apply this sort of solution to your existing workbook.
Get back to me if anything's not clear or you need any additional guidance.