John, try using a button (from the Forms Toolbar) instead of using a commandbutton (from the Control Toolbox Toolbar). I think a commandbutton only works on the sheet it resides. You can assign a macro to the button by right clicking on the button and selecting Assign Macro.
Hope this helps you out.
BarrieBarrie Davidson
Barrie,
This is and isn't true, you can put the code right in the sheet module like you do on a UserForm, but you can also refer to it like this.
Sheet1.CommandButton1
Juan Pablo
Juan, would you mind providing the syntax if I wanted to put a commandbutton in Sheet1 and have it copy a range named "CopyRange" to Sheet2 (A1) when clicked (this is an opportunity to learn something that I just don't want to pass up)?
Sincerely,
Barrie
Perhaps I'm missing something, but is it not merely :-
Private Sub CommandButton1_Click()
Sheets("Sheet1").Range("CopyRange").Copy Sheets("Sheet2").Range("A1")
End Sub
I'm sorry for the long reply, but...
my internet connection just drop and till now i got it up, the code is the same i was going to post, with just one more thing, to avoid any unexpected errors, you should add something like
ActiveCell.Activate
To the beggining of the macro to let the worksheet regain focus.
Juan Pablo