How to copy commandbuttons

L

leonidas

Hi,

I have a worksheet (sheet1) with four commandbuttons on row1 and I have
added a new worksheet (sheet2). When I unprotect sheet1, activate the
button "Design Mode" on the "Control Toolbox" toolbar, copy row1 and
paste it as row1 on sheet2, the commandbuttons are also copied.
When I record this with the macro recorder (see code below) and play
the macro afterwards it copies row1 but the commandbuttons are NOT
copied.
What do I need to change to also copy these commandbuttons? Thanks in
advance!


Code:
--------------------
Sheets("Sheet1").Select
Sheets.Add
Sheets("Sheet1").Select
ActiveSheet.Unprotect
Rows("1:1").Select
Selection.Copy
Sheets("Sheet2").Select
Rows("1:1").Select
ActiveSheet.Paste
 
B

Bernie Deitrick

leonidas,

Use the commandbuttons from the Forms commandbar, rather than the commandbuttons from the Control
Toolbox. You will need to assign a macro rather than use a click event, but the forms
commandbuttons can have their properties set to be moved and sized with a range, which makes them
'copy-able' through code.

HTH,
Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top