Copying form control button between tabs

AlexCS

Board Regular
Joined
Oct 31, 2011
Messages
78
Hi everyone,

How does one have to reference a form control button to be able to copy it from one tab to another in the same worksheet?

Copying the whole tab does not solve the problem sadly. Also, when trying to use the code resulting from the macro recorder, I am being told my button cannot be found. The button is called Send e-mail

The syntax of my copy-paste job (the button is in the range mentioned)

Sheets("Template by del").Select
ActiveSheet.Range("A1:Z500").Copy
Sheets("Sheet" & k).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False

What the macro recorder says

Sheets("Template by del").Select
ActiveSheet.Shapes("Button 1").Select
Selection.Copy
Sheets("Sheet" & k).Select
Range("J1").Select
ActiveSheet.Buttons.Add(960.75, 15.75, 108, 21.75).Select
ActiveSheet.Paste
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Each button on the tabbed form will be it's own control, therefore you cannot just 'copy' it. You will need to create separate buttons. If you want the buttons to all do the same thing then put the processing code in a sub procedure in a module and on each commandbutton___click event simply call the module sub procedure
 
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top