View Single Post
  #1   Report Post  
Dave Peterson
 
Posts: n/a
Default Command Button VBA code

It sounds like you have different buttons on the sheets.

There's a commandbutton on the control toolbox toolbar that has code associated
with its click event. This gets copied when the worksheet gets copied.

There's a button on the Forms toolbar that can have a macro assigned to it.
This code doesn't automatically get copied.

If you rightclick on a button and see "assign macro", it's a Forms toolbar
button. If you don't see that option, it's from the control toolbox toolbar.

(It sounds like the simplest approach for you would be to replace the forms
toolbar buttons with control toolbox toolbar buttons (and move/copy/adjust the
code).)

Terry wrote:

Can anyone help? I have a xls file OfficeXP. I have
command buttons on it with vba code behind the buttons.
In one file that I have when I use the copy sheet function
it copies the button and the code behind the button to a
new sheet in the same file. In the other file when a
sheet is copied the button is copied but it does not have
any coding behind it. Why would these behave
differently? I want the code copied with the sheet and
button.
Thanks for any help..


--

Dave Peterson