VBA & Macro Problems

Copy an ActiveX Control and Its Code to Excel Worksheets

John WilsonJohn Wilson Nov 27, 2026 869 views

Question details

The user needs to copy an Excel ActiveX control and its event code to other worksheets.

Copy an ActiveX Control and Its Code to Excel Worksheets
Product
Microsoft Excel
Device & OS
not provided
Scenario
An ActiveX control on one worksheet needs to be reused on other worksheets.
Observed behavior
Copying the control alone can leave the new control without its event procedure because the code is stored in the original worksheet's module.
Before you start

Open the workbook in a desktop version of Excel that supports ActiveX and VBA, and check that the Developer tab is available. ActiveX controls or macros may be blocked by Excel security settings; only enable content from a trusted source.

Solution 1Recommended

Copy the Entire Worksheet with Its ActiveX Control and Code

Use this method when you can duplicate the source worksheet rather than add the control to an existing sheet.

1
Open the copy command

Right-click the source worksheet tab and select Move or Copy.

2
Create a worksheet copy

Choose the destination workbook and sheet position, select Create a copy, and click OK. The copied worksheet includes the control and its worksheet-module code.

3
Test the copied control

On the copied sheet, turn off Developer > Design Mode if it is enabled, then click the control. Check that any worksheet references in the code point to the intended sheets.

Copy the Entire Worksheet with Its ActiveX Control and Code
Free Microsoft Office alternative

Edit Excel Workbooks with WPS Spreadsheet

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and support for common Excel formats, making it easy to move everyday workbook editing to WPS. Excel ActiveX controls and VBA macros may not work the same way, so keep Excel for workflows that depend on them.

Open and edit Excel-compatible XLSX workbooksUse a familiar spreadsheet interface for everyday editingMove between common Office file formats with less disruptionKeep using Excel for ActiveX-dependent workbook automation
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't the copied ActiveX button run its code?

The button's event procedure is stored in the source worksheet module, not in the control itself. Copy the worksheet with Move or Copy, or paste the event procedure into the destination worksheet module.

How do I find an ActiveX control's event code?

Select Developer > Design Mode, right-click the control, and choose View Code. Excel opens the corresponding worksheet module in the VBA editor.

Can multiple ActiveX controls use one shared macro?

ActiveX controls use worksheet event procedures rather than assigned macros. Those procedures can call a shared routine in a standard module, or you can use Forms controls and assign them directly to a shared macro.

Why is my ActiveX control still unavailable after copying it?

Check whether Developer > Design Mode is on and review Excel's ActiveX and macro security settings. ActiveX may be disabled by default in some Office versions; enable content only if you trust the workbook.