Friday, October 7, 2016

Chaining operations in Open Office calc

When you are writing macros for Open Office calc, I often need to make my calculation sequence maintain data in the Basic system.  Hence I have o chain my cells so they act like a linear program.

I have an array on my sheet, each column needs to execute its row in sequence.

My macros have an optional argument which is unused, but it maintains calculation sequences when calc runs through the cell array.

Function RowElement(arg as integer, x as variant) ' x is not used

Then each row in that column references the row just above, up to the top member, the start.  

Then the next column over, will reference the last element of the previous column  Thus I can fore the sequence to go by row, not column ( or visa versa).  It works only for linear sequences, calc gets confused otherwise.

For example, I generate an array of all the major scale notes.  The column head generates the column of notes, inside the basic system.  That data is maintained while each row element in the column uses it, then the next row can re-use the same data array inside Basic.  I learned this trick back when I was trying to smash protons with Open Office calc.

No comments: