Improve the speed of the styles-optimiser when there are many styles in a Workbook Profiling showed that the call to isUserDefined() took most of the time, so we now fetch this only once for each style and remember the result and use it in the inner loop. The attached sample-file took aprox. 1m30s on a decent machine, now it is down to around 2s.