How can I dynamically add an activeX control and code it?

brian1cj

New Member
Joined
Apr 18, 2011
Messages
2
Here is a simmered down version of what I want to do:

1) Use the open workbook event to delete all sheets and create new sheets dynamically
2) Add an activeX spinner control to one of the new sheets that I dynamically created
3) Code the spinner control to change the value of cell a1 on the newly created sheet.

I am stuck on #3. Normally the code that drives the control is stored in the worksheet, but in my case, I am dynamically creating the worksheet so the code cannot be stored there. Can I put it in a module or something? How would I do this? Been googling and searching for a couple hours. I'm learning way more than I care to about activeX controls, but no luck on trying to accomplish this.

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.
Why don't you just use a template workbook/worksheet?
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,633
Members
452,933
Latest member
patv

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