Re: Code does not 'run' when assigned to a button
Is there a reason why this may be occurring?
Obviously there is, but there's not enough information in your post to say why.
it fails to run in the same way and encounters errors
You should expend that statement - what does it do, or not do, depending how you start it? What errors occur? (Probably 1004, though - but that's just as unhelpful).
What type of button is it? ActiveX or Forms?
What type of module contains the code? (Standard code module/Class module/worksheet class/userform)...?