something strange in your code.
in the first part of initialization, SettingsForm appears !!!

may be should you declare all variables with dim or global and use SettingsForm only in the function
_________________________
Christophe