Thank you all for these helpful suggestions. Let me respond one by one:
Nesr: points 1,2 and 3 - these are in hand. Point 4: Most of the functions are called multiple times so I think it would be hard to do this. However there may be some that I can change.
Zack: Long vs Integer. As you say, I would have been surprised if this had made a lot of difference, but I did it anyway and the change was indeed negligible. But very curiously the change seems to have removed a completely different bug. I was getting a VALUE! error which resolved itself when I put the cursor in the cell and clicked the green tick next to the edit bar to indicate that this was indeed the formula I wanted. If the function used/returned integer -> error; if it used/returned long -> no error. And to avoid any doubt the results are always whole numbers in the range 0 - 100, with checks in the code to handle invalid inputs or results. I am pretty sure that I made no other changes that could have removed the bug. (shrugs) Well, that's it: no more integers for me.
Zack:
- great tip, thanks; and thanks for the code snippet. First job for today.
Zack:
Quote:
|
dimensioning like this...
|
. I can only echo TurboDante: Ekkk

Ekkk

(that's the echo). Correction: that's the first job today!
Zack:
Quote:
|
Trimming your code down and explicitly referencing everything..
|
That also gives me food for thought. My normal 'habitat' is in compiled languages and I guess I have got used to automatic optimisation by the compiler. I must revisit my code with this in mind. Thanks for the reminder.
Zack:
Quote:
|
where did the "ReportPage" variable come from in your UDF above? The variable isn't in the scope of the UDF, so I'm assuming it's either a public type or variable set somewhere else. And what is "IsOk()"? Looks like another call, most likely to another UDF?
|
Yes, I define a whole bunch of Public Constants with names of worksheets, special rows/columns/cells so that if changes are necessary they only need to be made once at the top of one module. And IsOK() is another UDF call. Sorry, I should have explained that a bit more clearly. (Another code optimisation opportunity?)
Nesr:
Quote:
|
defInt I-M ' all variables starts with letters I, J, K, L, and M are considered Integer |
Gosh, that takes me back more years than I care to count.

It is a workable option, but I have got so used to putting type declarations in functions, I'll put up with the extra typing.
Thanks again! Time to try all this out (rolls sleeves up).