If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below. If you don't like Google AdSense in the posts, register or log in above.

Programmatically Add Code to a Sheet Module

June 14th, 2018, 02:23

Hi everyone,

Long time forum browser, first time posting.

Is there a way via VBE to programmatically add an event change handler to a sheet module? I searched many threads, and most suggestions involve a template or a copy and paste. What I'd like to do is write the event change code in an existing macro, so when the new sheet is created the code is inserted into the module.

If that isn't a viable option, then perhaps I could contain the code in a normal code module in my personal workbook and find a way to copy it to the appropriate sheet module.

A quick explanation of the scope: I receive a data dump from another system delivered in xls. I have written code that cleans up the data, adds a number of formulas and puts the data in a fresh workbook. The problem is, I have created a dropdown via data validation and I need the worksheet change handler in this new workbook/sheet.

Once complete, I plan on creating an addin so end users have the same functionality. So I'd like this to be as self-contained as possible.

Thank you in advance for taking the time to read this, and I look forward to your guidance.

Comment

Ozgrid is Not Associated With Microsoft. Ozgrid Retains the Rights to ALL Posts and Threads

All times are GMT+8. This page was generated at 1 minute ago.

Working...

X

We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, personalize advertising, and to analyze site activity. We may share certain information about our users with our advertising and analytics partners. For additional details, refer to our Privacy Policy.

By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.