Control Objects

Joker4321

Board Regular
Joined
Jan 5, 2007
Messages
60
Hi, I have a table with control check boxes that I copy from one sheet to another when a user needs to insert a new table. The control boxes have code in them that activates a particular textbox when they are clicked and I have made it so only one check box can be selected at a time. Is there a way to transfer the code for the check boxes when I copy and paste them from sheet to sheet? Thanks!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
If you switch to Forms Checkboxes, the assigned code will automatically transfer when copied.
With Controls Checkboxes you will have to build some rather involved code. I wouldn't bother when the Forms Checkboxes already do what you want.
 

Joker4321

Board Regular
Joined
Jan 5, 2007
Messages
60
ok...can I have a macro within the forms check box similar to the command checkboxes such as

Private Sub CheckBox1_Click()

End Sub

or do you have to use the assign macro function?

Thanks a bunch John...you've helped a great deal
 

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
You are correct.
Just use the Assign Macro option. That macro code will stay with the object when you copy it.
 

Joker4321

Board Regular
Joined
Jan 5, 2007
Messages
60
Hey John,

Any ideas on how to copy and paste objects from one sheet to another without activating the sheets?

this is what I have so far

Worksheets("sheet1").Shapes.Range(Array("CheckBox1", "CheckBox2", "TextBox1", "TextBox2" _
)).Select

the above only works when sheet1 is the active sheet.
 

Forum statistics

Threads
1,181,055
Messages
5,927,863
Members
436,573
Latest member
CMR237

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
Top