Announcement

Collapse
No announcement yet.

Programmatically Add Code to a Sheet Module

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Programmatically Add Code to a Sheet Module



    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.

    -B

  • #2


    Hi,

    Chip has created a brilliant solution ... which can surely help you out ...

    http://www.cpearson.com/Excel/vbe.aspx

    Hope this will help
    If you feel like saying "Thank You" for the help received ...You can click on the "Like" icon ...just underneath ... ... in the bottom right corner ...

    Comment

    Working...
    X