> > I have the following problem with Excel 97: If a VB function that > returns > an array is called from the worksheet (the formula is entered using > CTRL-SHIFT-ENTER) , the function gets called as many times as there are > elements in the output range, even though one call to the function > returns > an array of the same size as the output range. > > So for instance if I write a VBA function to add matrices in the > worksheet > the function will be called a number of times equal to the total size of > the matrix, > instead of being called once. > > To make things worse, the problem does not occur the first time the > formula is > entered, but only at subsequent times after the worksheet has beem saved > and > re-opened. > > Is this a feature or a bug ? did anyone else notice that ? > > below is an example of a VBA function that causes this behaviour: > Public Function test_bug(ByVal x As Double) As Variant > Dim y(1 To 3, 1 To 1) As Double > y(1, 1) = 1 > y(2, 1) = 2 > y(3, 1) = 3 > test_bug = y > End Function > > just enter the formula on 3 consecutive cells (in the same column) on > the spreadsheet. > > Any help would be greatly appreciated. > Thanks I had noticed many times this very annoying problem (I was working on XLL functions supporting very large ranges in the parameters -sometimes more than 4000 cells... and I've spent many hours trying to solve this terrible bug, which I thought was due to my own code!!!) I have recently installed the Excel Service Release 1, and now this calculation bug seems to have fully disappeared. You can download the SR-1 at the Microsoft site (http://www.microsoft.com). Cordialement, Laurent Longre Mais au fait, tu es Francophone, d'aprиs ton nom? Alors bon Noлl а toi. Laurent Longre