The procedure should go into a regular code module, not a worksheet module
or the ThisWorkbook module.
If the button is a controls toolbox button, call the main procedure from the
_Click event procedure in the worksheet code module. If it's a forms toolbar
button, assign the main procedure to the button.
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______
"Nik" wrote in message
...
joecrabtree wrote:
Hi,
Just had a thought, I placed this macro in the worksheet and ran it
from a button rather than in a module. Could this be the reason it
didn't work?
I can't see why it makes a difference, but it seems to. The button is
okay, but the code being in a worksheet seems to produce the probelm you
describe. The 'ThisWorkbook' object is okay...
Any ideas why, anyone?
Nik