Relinking Buttons and code on copied worksheets?

teachman

Active Member
Joined
Aug 31, 2011
Messages
321
Hello,

I am in a project that utilizes Excel to build data entry forms that are printed out and filled out with a digital pen in the field. The pen is then docked back to the computer and the data is downloaded to the Excel file that printed the form.

The result of this is that the form itself, is Sheet1 in the workbook and the process makes a copy of Sheet1 inserts it as the last worksheet, Sheet6 for example, and fills in the data collected. The problem is that Sheet1 has an Error Checking button/vba script imbedded in it. When the worksheet is copied, the button and macro code are also copied but the macro is run against Sheet1 and not Sheet6. Even though, Sheet6 has the macro code with it.

What I would like to do, programmatically, is to link the Error Check button on Sheet6 with the macro code that is also with Sheet6.

Any ideas?

Thanks,

George Teachman
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Kind of hard to tell without seeing the code, but my idea is...
Is the code specifying sheet1 by name? If so, then I would think anywhere it references Sheet1, you might simply change that to read "ActiveSheet", assuming that (per your example) Sheet6 is the active sheet when you want to run the code from sheet6.

(Does that make sense?)
 
Upvote 0

Forum statistics

Threads
1,202,911
Messages
6,052,517
Members
444,588
Latest member
ViJN

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