Copy Paste worksheet creates error on buttons

deduwa

Board Regular
Joined
Jul 28, 2015
Messages
110
Hi,

I have a recorded macro that copies existing worksheet and pastes it to the right. The existing sheet has 4 ActiveX buttons (Each have their own related macro in the background).

The code is;

Sheets("Sheet1").Select
ActiveSheet.Buttons.Add(2118, 114.75, 131.25, 22.5).Select
ActiveSheet.Buttons.Add(2118, 29.25, 87.75, 15.75).Select
ActiveSheet.Buttons.Add(2118.75, 84, 66, 16.5).Select
ActiveSheet.Buttons.Add(2117.25, 56.25, 193.5, 18.75).Select
Sheets("Sheet1").Copy Before:=Sheets(2)
Sheets("Sheet1 (2)").Select
Sheets("Sheet1 (2)").Name = "Sheet1 (FX)"
Range("D267").Select


The issue I have is that when this macro executes, in both the original and new worksheet, the text within the ActiveX buttons disappears and is replaced by "Button 1", "Button 2" etc....

Is there a fix for this? I want the original text to stay as it is.

Thanks
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
All you should need is something like this:
When you copy the sheet all the buttons are also copied to the new sheet.
Code:
Sub Copy_Sheet()
'Modified  7/25/2018  11:24:43 AM  EDT
Sheets("Me").Copy Before:=Sheets(2)
ActiveSheet.Name = "Sheet1(FX)"
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,180
Members
452,615
Latest member
bogeys2birdies

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