RFreunc said:
How is the input box that is determining the number of rows to copy, definded in the macro?
I'm not Pete, but if I understand you correctly your question seems simple enough to answer. The box is given a "name" and referred to by that name in the macro. In Excel 2010, go to Formulas->Name Manager. In early versions I think it's under Insert->Name. You'll see "Ncourses" refers to "=Sheet1!$B$9". Excel automatically updates formulas as the cells move around. Then, in the macro, the name is used instead of the cell reference:
Anyway, what I really wanted to post was a method for getting the other technique to work under Excel 2010. The other technique uses a written equation and on-the-fly generated values, and uses "Evaluate" to iterate the equation. It seems the "Evaluate" formula disappeared somewhere around 2007 and these tricks don't work.
After a bit of mucking around I've found a simple solution:
[ol]
[li]Insert a udf (User-defined formula)[/li]
[ol a]
[li]In the Developer tab, click the Visual Basic button.[/li]
[li]From the Insert menu, select Module[/li]
[/ol]
[li]Paste the following code:[/li]
Code:
Function Eval(r As String) As Variant
Eval = Evaluate(r)
End Function
[li]Hit save and switch back to the sheet.[/li]
[li]In the Forumlas tab, click the Name Manager button[/li]
[li]Replace all occurrences of "Evaluate" with "Eval"[/li]
[li]Ok, refresh, viola.[/li]
[/ol]
HTH