Hi nigelog,
I didn't look at Greg's solution, but here is something else for you to look at. I prefer to have most of my code in an ordinary code module. It is a matter of personal preference. It makes the UserForm code smaller, and allows me to find the UserForm event handlers sooner.
It is a best practice to declare all variables. If you misspell a variable in your code, VBA will silently assume it is a Variant variable and go on executing with no clue to you that you have a bug. Go to the VBA development window, click Tools, Options, and check "Require Variable Declaration." This will insert the following line at the top of all new modules:
This option requires all variables to be declared and will give a compiler error for undeclared variables.
In the UserForm Code Module:
In Ordinary Code Module Module1:
Lewis
Bookmarks