[Solved] Calling Calc Functions From Macro
Posted: Sat Jul 04, 2009 5:37 am
Hello.
I have a spreadsheet that will soon have about 20 columns of data, with 99 rows of data each. I'm trying to find a formula to predict the data, so each column of recorded data will have a corresponding column that gives a prediction based on my formula and a couple of parameters (which are located elsewhere in the spreadsheet and I can modify there if necessary) as well as another corresponding column calculating the difference between my formula's prediction and the actual data.
The problem is that I will be modifying the formula itself frequently in an attempt to find the right one. So changing it and copying it to roughly 2000 cells would be a huge pain. It would be far easier to define the function in one place and change it there. I have found out how to use a macro in Basic to define a function with parameters that can be called in the cells, but my formula is at present using some spreadsheet functions. Is there a way to call spreadsheet functions from inside a macro?
If not, is one of the macro languages better than the others for mathematical operations? Also, where can I find something about the mathematical API for whichever language is best?
I do have programming experience (primarily in Java and a tiny bit in C), but I've never worked with any of the languages listed for macro creation. Obviously, if there's a better way to define a spreadsheet function than using a macro, I'm open to that.
Also on a side note, I wasn't sure if this belonged here or in the Calc section, so sorry if it's in the wrong place.
I have a spreadsheet that will soon have about 20 columns of data, with 99 rows of data each. I'm trying to find a formula to predict the data, so each column of recorded data will have a corresponding column that gives a prediction based on my formula and a couple of parameters (which are located elsewhere in the spreadsheet and I can modify there if necessary) as well as another corresponding column calculating the difference between my formula's prediction and the actual data.
The problem is that I will be modifying the formula itself frequently in an attempt to find the right one. So changing it and copying it to roughly 2000 cells would be a huge pain. It would be far easier to define the function in one place and change it there. I have found out how to use a macro in Basic to define a function with parameters that can be called in the cells, but my formula is at present using some spreadsheet functions. Is there a way to call spreadsheet functions from inside a macro?
If not, is one of the macro languages better than the others for mathematical operations? Also, where can I find something about the mathematical API for whichever language is best?
I do have programming experience (primarily in Java and a tiny bit in C), but I've never worked with any of the languages listed for macro creation. Obviously, if there's a better way to define a spreadsheet function than using a macro, I'm open to that.
Also on a side note, I wasn't sure if this belonged here or in the Calc section, so sorry if it's in the wrong place.